[PATCH] D46369: [llvm-objcopy] Add --strip-symbol (-N) option

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 03:11:07 PDT 2018


jhenderson added a comment.

Whilst we want to enable users to do slightly strange things, I don't think we want to leave the ELF in an invalid state. I am aware of two issues with removing symbols:

1. Relocations targeting the specified symbol:

GNU objcopy's behaviour: don't strip the symbol, and print a message (printing a message is incredibly rare in GNU objcopy!).
With this patch llvm-objcopy's behaviour: strip the symbol, and leave the relocation with an invalid symbol reference, rendering tools unable to use the file.

2. Groups using the specified symbol as its signature:

GNU objcopy's behaviour: discard the group.
With this patch llvm-objcopy's behaviour: strip the symbol, and leave an invalid reference in the group's sh_info field (in my case, on a Windows debug build, I get the value 0xDDDDDDDD).

Neither of these behaviour's are good in my opinion. When we strip sections, we don't allow stripping sections which are referenced from elsewhere, for example.


Repository:
  rL LLVM

https://reviews.llvm.org/D46369





More information about the llvm-commits mailing list