[llvm-readobj] - Teach readobj to recognize SHF_COMPRESSED flag.

Main problem here was that SHF_COMPRESSED has the same value with
XCORE_SHF_CP_SECTION, which was included as standart (common) flag.
As far I understand xCore is a family of controllers and it that
means it's constant should be processed separately,
only if e_machine == EM_XCORE, otherwise llvm-readobj would output
different constants twice for compressed section:

Flags [
..
SHF_COMPRESSED (0x800)
..
XCORE_SHF_CP_SECTION (0x800)
..
]

what probably does not make sence if you're not working with xcore file.

Differential revision: http://reviews.llvm.org/D20273

llvm-svn: 270320
This commit is contained in:
George Rimar 2016-05-21 10:16:58 +00:00
parent 0287e17d09
commit c13c59afa7
3 changed files with 19 additions and 2 deletions

View File

@ -0,0 +1,9 @@
RUN: llvm-readobj -sections \
RUN: %p/Inputs/compression.zlib.style.elf-x86-64 | FileCheck %s
CHECK: Section {
CHECK: Name: .debug_info
CHECK-NEXT: Type: SHT_PROGBITS
CHECK-NEXT: Flags [
CHECK-NEXT: SHF_COMPRESSED (0x800)
CHECK-NEXT: ]

View File

@ -994,8 +994,12 @@ static const EnumEntry<unsigned> ElfSectionFlags[] = {
ENUM_ENT(SHF_TLS, "T"),
ENUM_ENT(SHF_MASKOS, "o"),
ENUM_ENT(SHF_MASKPROC, "p"),
ENUM_ENT_1(XCORE_SHF_CP_SECTION),
ENUM_ENT_1(XCORE_SHF_DP_SECTION),
ENUM_ENT_1(SHF_COMPRESSED),
};
static const EnumEntry<unsigned> ElfXCoreSectionFlags[] = {
LLVM_READOBJ_ENUM_ENT(ELF, XCORE_SHF_CP_SECTION),
LLVM_READOBJ_ENUM_ENT(ELF, XCORE_SHF_DP_SECTION)
};
static const EnumEntry<unsigned> ElfAMDGPUSectionFlags[] = {
@ -3281,6 +3285,10 @@ template <class ELFT> void LLVMStyle<ELFT>::printSections(const ELFO *Obj) {
SectionFlags.insert(SectionFlags.end(), std::begin(ElfX86_64SectionFlags),
std::end(ElfX86_64SectionFlags));
break;
case EM_XCORE:
SectionFlags.insert(SectionFlags.end(), std::begin(ElfXCoreSectionFlags),
std::end(ElfXCoreSectionFlags));
break;
default:
// Nothing to do.
break;