[PATCH] D37393: [llvm-objcopy] Add support for special section indexes in symbol table greater than SHN_LORESERVE

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 02:51:49 PDT 2017


jhenderson added inline comments.


================
Comment at: test/tools/llvm-objcopy/section-index-unsupported.test:2
+# RUN: yaml2obj %s > %t
+# RUN: not llvm-objcopy %t %t2
+
----------------
I think we should also check the error message here.


================
Comment at: tools/llvm-objcopy/Object.cpp:93
 
+bool isValidReservedSectionIndex(uint32_t Index) {
+  switch (Index) {
----------------
uint32_t -> uint16_t (to match st_shndx size).


================
Comment at: tools/llvm-objcopy/Object.cpp:123
+      return static_cast<uint16_t>(ShndxType);
+    }
+  }
----------------
I think this should have an llvm_unreachable clause at the end.


================
Comment at: tools/llvm-objcopy/Object.h:152
   void addSymbol(llvm::StringRef Name, uint8_t Bind, uint8_t Type,
-                 SectionBase *DefinedIn, uint64_t Value, uint64_t Sz);
+                 SectionBase *DefinedIn, uint64_t Value, uint32_t SectionIndex,
+                 uint64_t Sz);
----------------
SectionIndex -> Shndx. It should also be a uint16_t, since that is the st_shndx field size.


Repository:
  rL LLVM

https://reviews.llvm.org/D37393





More information about the llvm-commits mailing list