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

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 13:31:54 PDT 2018


rupprecht 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;
----------------
jakehehrlich wrote:
> 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.
It's expected to be 0 and AFAICT it will always be 0 the way it's currently written, but there's no reason to not just be explicit about it.


Repository:
  rL LLVM

https://reviews.llvm.org/D51493





More information about the llvm-commits mailing list