[PATCH] D47052: [llvm-objcopy] Fix the behavior of --strip-* and --keep-symbol

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 01:57:07 PDT 2018


alexshap added a comment.

@jhenderson, 
i don't know why binutils objcopy is doing it.

[alexshap at devvm1372.frc2 ~/local] cat a.c
int xx = 12;
int yy() { return 11; }
[alexshap at devvm1372.frc2 ~/local] gcc -c -g a.c -o a.o
[alexshap at devvm1372.frc2 ~/local] objcopy --strip-all --keep-symbol yy a.o b.o
[alexshap at devvm1372.frc2 ~/local] ~/llvm-readobj.sh -symbols b.o | grep Local

  Binding: Local (0x0)
  Binding: Local (0x0)
  Binding: Local (0x0)
  Binding: Local (0x0)
  Binding: Local (0x0)
  Binding: Local (0x0)
  Binding: Local (0x0)

[alexshap at devvm1372.frc2 ~/local] ~/llvm-readobj.sh -symbols b.o | grep yy

  Name: yy (1)

[alexshap at devvm1372.frc2 ~/local] ~/llvm-readobj.sh -symbols b.o | grep xx
[alexshap at devvm1372.frc2 ~/local]

so basically we can implement this option without trying to repeat binutils behavior,
what would you say to this ? if so I can update the patch (and actually the code will be simpler)


Repository:
  rL LLVM

https://reviews.llvm.org/D47052





More information about the llvm-commits mailing list