[llvm] r270320 - [llvm-readobj] - Teach readobj to recognize SHF_COMPRESSED flag.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Sat May 21 03:17:05 PDT 2016
Author: grimar
Date: Sat May 21 05:16:58 2016
New Revision: 270320
URL: http://llvm.org/viewvc/llvm-project?rev=270320&view=rev
Log:
[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
Added:
llvm/trunk/test/tools/llvm-readobj/Inputs/compression.zlib.style.elf-x86-64 (with props)
llvm/trunk/test/tools/llvm-readobj/elf-sec-compressed.test
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Added: llvm/trunk/test/tools/llvm-readobj/Inputs/compression.zlib.style.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/compression.zlib.style.elf-x86-64?rev=270320&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/tools/llvm-readobj/Inputs/compression.zlib.style.elf-x86-64
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: llvm/trunk/test/tools/llvm-readobj/elf-sec-compressed.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/elf-sec-compressed.test?rev=270320&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/elf-sec-compressed.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/elf-sec-compressed.test Sat May 21 05:16:58 2016
@@ -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: ]
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=270320&r1=270319&r2=270320&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Sat May 21 05:16:58 2016
@@ -994,8 +994,12 @@ static const EnumEntry<unsigned> ElfSect
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<ELF
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;
More information about the llvm-commits
mailing list