mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 04:46:27 +08:00
[RISCV] ELF attribute section for RISC-V.
Leverage ARM ELF build attribute section to create ELF attribute section for RISC-V. Extract the common part of parsing logic for this section into ELFAttributeParser.[cpp|h] and ELFAttributes.[cpp|h]. Differential Revision: https://reviews.llvm.org/D74023
This commit is contained in:
@@ -669,7 +669,9 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats) {
|
||||
// the input objects have been compiled.
|
||||
static void updateARMVFPArgs(const ARMAttributeParser &attributes,
|
||||
const InputFile *f) {
|
||||
if (!attributes.hasAttribute(ARMBuildAttrs::ABI_VFP_args))
|
||||
Optional<unsigned> attr =
|
||||
attributes.getAttributeValue(ARMBuildAttrs::ABI_VFP_args);
|
||||
if (!attr.hasValue())
|
||||
// If an ABI tag isn't present then it is implicitly given the value of 0
|
||||
// which maps to ARMBuildAttrs::BaseAAPCS. However many assembler files,
|
||||
// including some in glibc that don't use FP args (and should have value 3)
|
||||
@@ -677,7 +679,7 @@ static void updateARMVFPArgs(const ARMAttributeParser &attributes,
|
||||
// as a clash.
|
||||
return;
|
||||
|
||||
unsigned vfpArgs = attributes.getAttributeValue(ARMBuildAttrs::ABI_VFP_args);
|
||||
unsigned vfpArgs = attr.getValue();
|
||||
ARMVFPArgKind arg;
|
||||
switch (vfpArgs) {
|
||||
case ARMBuildAttrs::BaseAAPCS:
|
||||
@@ -714,9 +716,11 @@ static void updateARMVFPArgs(const ARMAttributeParser &attributes,
|
||||
// is compiled with an architecture that supports these features then lld is
|
||||
// permitted to use them.
|
||||
static void updateSupportedARMFeatures(const ARMAttributeParser &attributes) {
|
||||
if (!attributes.hasAttribute(ARMBuildAttrs::CPU_arch))
|
||||
Optional<unsigned> attr =
|
||||
attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
|
||||
if (!attr.hasValue())
|
||||
return;
|
||||
auto arch = attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
|
||||
auto arch = attr.getValue();
|
||||
switch (arch) {
|
||||
case ARMBuildAttrs::Pre_v4:
|
||||
case ARMBuildAttrs::v4:
|
||||
|
||||
Reference in New Issue
Block a user