[PATCH] D20273: [llvm-readobj] - Teach readobj to recognize SHF_COMPRESSED flag.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sun May 15 04:28:06 PDT 2016


grimar created this revision.
grimar added reviewers: davide, rafael, ruiu, echristo.
grimar added subscribers: llvm-commits, grimar.
Herald added a subscriber: joker.eph.

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 ouput different constants twice for compressed section:

```
SHF_COMPRESSED (0x800)
....
XCORE_SHF_CP_SECTION (0x800)
```

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

http://reviews.llvm.org/D20273

Files:
  ELFDumper.cpp

Index: ELFDumper.cpp
===================================================================
--- ELFDumper.cpp
+++ ELFDumper.cpp
@@ -992,8 +992,12 @@
   ENUM_ENT(SHF_OS_NONCONFORMING, "o"),
   ENUM_ENT(SHF_GROUP,            "G"),
   ENUM_ENT(SHF_TLS,              "T"),
-  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[] = {
@@ -3278,6 +3282,9 @@
       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));
     default:
       // Nothing to do.
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20273.57293.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160515/ed60c83f/attachment.bin>


More information about the llvm-commits mailing list