llvm-project/llvm/tools/llvm-objcopy
Peter Collingbourne 1651ac13be llvm-objcopy: Set sh_link to 0 on unrecognized symtab-linked sections.
Per discussion on the generic-abi mailing list:
https://groups.google.com/forum/#!topic/generic-abi/MPr8TVtnVn4

An object file manipulation tool must either write out a symbol
table with the same number of entries as the original symbol table
and in the same order, or if this is impossible, refuse to operate
on the object file if it has unrecognized sections that are linked
to the symtab section. However, existing tools (namely GNU strip,
GNU objcopy and ld.{bfd,gold,lld} -r) do not comply with this at
present: they change symbol table indexes and set sh_link to 0 on
the unrecognized symtab-linked sections.

We intend to use the latter as a (temporary) signal that a tool has
operated on a proposed new symtab-linked section and invalidated the
symbol table indexes. However, llvm-objcopy currently keeps sh_link
pointing to the new symtab section. This patch changes llvm-objcopy
to set sh_link to 0 to match the behaviour of the other tools.

Differential Revision: https://reviews.llvm.org/D47404

llvm-svn: 333581
2018-05-30 19:30:39 +00:00
..
CMakeLists.txt [tools] Introduce llvm-strip 2018-05-07 19:32:09 +00:00
LLVMBuild.txt Recommit "[llvm-objcopy] Switch over to using TableGen for parsing arguments" 2018-04-24 05:43:32 +00:00
ObjcopyOpts.td [llvm-objcopy] Add --keep-file-symbols option 2018-05-26 08:10:37 +00:00
Object.cpp llvm-objcopy: Set sh_link to 0 on unrecognized symtab-linked sections. 2018-05-30 19:30:39 +00:00
Object.h [llvm-objcopy] Add --strip-unneeded option 2018-05-25 11:01:25 +00:00
StripOpts.td [llvm-strip] Expose --keep-symbol option 2018-05-23 19:44:19 +00:00
llvm-objcopy.cpp [llvm-objcopy] Add --keep-file-symbols option 2018-05-26 08:10:37 +00:00
llvm-objcopy.h [llvm-objcopy] Refactor llvm-objcopy to use reader and writer objects 2018-01-25 22:46:17 +00:00