[PATCH] D150859: [llvm-objcopy][ELF] Preserve sh_link to .symtab when applicable

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 11:22:26 PDT 2023


andrewng added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/ELF/symtab-link.test:22
+# RUN: llvm-objcopy --strip-symbol baz %t %t6
+# RUN: llvm-readobj --sections %t6 | FileCheck %s --check-prefix=LINK-0
+## Re-order symbols.
----------------
jhenderson wrote:
> I'm probably missing something, but why does stripping the last symbol result in an index change (and therefore sh_link 0)?
It's treated as a change to the indices because there's now less than there were before, i.e. the last symbol could have been referenced by the linked section. It is a bit conservative because you could add and then remove those symbols and still have all the "original" symbols but that would complicate the patch and seems an unusual use (less) case in reality.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150859/new/

https://reviews.llvm.org/D150859



More information about the llvm-commits mailing list