1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[ELFYAML] Group ELF section type flags to target specific blocks.

Recognize only flags which correspond to the current target.

llvm-svn: 212880
This commit is contained in:
Simon Atanasyan 2014-07-12 18:25:08 +00:00
parent c0d64d2fdb
commit 149290dd5a
3 changed files with 31 additions and 9 deletions

View File

@ -298,6 +298,8 @@ void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration( void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration(
IO &IO, ELFYAML::ELF_SHT &Value) { IO &IO, ELFYAML::ELF_SHT &Value) {
const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
assert(Object && "The IO context is not initialized");
#define ECase(X) IO.enumCase(Value, #X, ELF::X); #define ECase(X) IO.enumCase(Value, #X, ELF::X);
ECase(SHT_NULL) ECase(SHT_NULL)
ECase(SHT_PROGBITS) ECase(SHT_PROGBITS)
@ -325,15 +327,27 @@ void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration(
ECase(SHT_GNU_versym) ECase(SHT_GNU_versym)
ECase(SHT_HIOS) ECase(SHT_HIOS)
ECase(SHT_LOPROC) ECase(SHT_LOPROC)
ECase(SHT_ARM_EXIDX) switch (Object->Header.Machine) {
ECase(SHT_ARM_PREEMPTMAP) case ELF::EM_ARM:
ECase(SHT_ARM_ATTRIBUTES) ECase(SHT_ARM_EXIDX)
ECase(SHT_ARM_DEBUGOVERLAY) ECase(SHT_ARM_PREEMPTMAP)
ECase(SHT_ARM_OVERLAYSECTION) ECase(SHT_ARM_ATTRIBUTES)
ECase(SHT_HEX_ORDERED) ECase(SHT_ARM_DEBUGOVERLAY)
ECase(SHT_X86_64_UNWIND) ECase(SHT_ARM_OVERLAYSECTION)
ECase(SHT_MIPS_REGINFO) break;
ECase(SHT_MIPS_OPTIONS) case ELF::EM_HEXAGON:
ECase(SHT_HEX_ORDERED)
break;
case ELF::EM_X86_64:
ECase(SHT_X86_64_UNWIND)
break;
case ELF::EM_MIPS:
ECase(SHT_MIPS_REGINFO)
ECase(SHT_MIPS_OPTIONS)
default:
// Nothing to do.
break;
}
#undef ECase #undef ECase
} }

Binary file not shown.

View File

@ -3,6 +3,8 @@ RUN: obj2yaml %p/Inputs/trivial-object-test.coff-x86-64 | FileCheck %s --check-p
RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mipsel | FileCheck %s --check-prefix ELF-MIPSEL RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mipsel | FileCheck %s --check-prefix ELF-MIPSEL
RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mips64el | FileCheck %s --check-prefix ELF-MIPS64EL RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mips64el | FileCheck %s --check-prefix ELF-MIPS64EL
RUN: obj2yaml %p/Inputs/trivial-object-test.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64 RUN: obj2yaml %p/Inputs/trivial-object-test.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64
RUN: obj2yaml %p/Inputs/unwind-section.elf-x86-64 \
RUN: | FileCheck %s --check-prefix ELF-X86-64-UNWIND
COFF-I386: header: COFF-I386: header:
COFF-I386-NEXT: Machine: IMAGE_FILE_MACHINE_I386 COFF-I386-NEXT: Machine: IMAGE_FILE_MACHINE_I386
@ -405,3 +407,9 @@ ELF-X86-64-NEXT: Section: .text
ELF-X86-64-NEXT: Size: 0x0000000000000026 ELF-X86-64-NEXT: Size: 0x0000000000000026
ELF-X86-64-NEXT: - Name: SomeOtherFunction ELF-X86-64-NEXT: - Name: SomeOtherFunction
ELF-X86-64-NEXT: - Name: puts ELF-X86-64-NEXT: - Name: puts
ELF-X86-64-UNWIND: - Name: .eh_frame
ELF-X86-64-UNWIND-NEXT: Type: SHT_X86_64_UNWIND
ELF-X86-64-UNWIND-NEXT: Flags: [ SHF_ALLOC ]
ELF-X86-64-UNWIND-NEXT: AddressAlign: 0x0000000000000001
ELF-X86-64-UNWIND-NEXT: Content: ''