[PATCH] D51493: [llvm-strip] Allow copying relocation sections without symbol tables.

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 10:31:29 PDT 2018


jakehehrlich added inline comments.


================
Comment at: tools/llvm-objcopy/Object.cpp:396
 void RelocSectionWithSymtabBase<SymTabType>::finalize() {
-  this->Link = Symbols->Index;
+  if (Symbols != nullptr)
+    this->Link = Symbols->Index;
----------------
alexshap wrote:
>  to double check - Link is not getting set at all (if Symbols == nullptr),  just wondering what the value will be in this case ? 0 or garbage ? probably i'd do what binutils objcopy does.  Asking just in case.
It will be whatever it originally was  in the file but it can only be SHN_UNDEF if Symbols == nullptr. That said I think I'd slightly prefer explicitly setting it to zero here because that's correct and it only just happens to be the case that this will always work correctly.


Repository:
  rL LLVM

https://reviews.llvm.org/D51493





More information about the llvm-commits mailing list