15

gcc and AMD Open64 opencc both have a -s option to "strip symbol table and relocation information". So far I haven't been able to find the same option in Clang/LLVM. Does it exist?

Reinderien
  • 11,755
  • 5
  • 49
  • 77
  • 1
    I think you should use `objcopy` (from binutils) to split off the symbols. This way you will have them handy in case one of your users experiences a crash, but you don't have to include them with the binary you give to users. – 0xC0000022L May 22 '11 at 02:29
  • looks like stuff was missed by an occasion. Please fill the PR in LLVM bugzilla. Thanks! – Anton Korobeynikov May 22 '11 at 05:59
  • @Anton Alright, I've filed http://llvm.org/bugs/show_bug.cgi?id=9986 . – Reinderien May 22 '11 at 18:55

1 Answers1

12

You can use a strip utility from binutils.

Actually, a llvm-ld has this options http://llvm.org/cmds/llvm-ld.html

-strip-all, -s Strip all debug and symbol information from the executable to make it smaller.

-strip-debug, -S Strip all debug information from the executable to make it smaller.

opt have something too:

-strip-debug This option causes opt to strip debug information from the module before applying other optimizations. It is essentially the same as -strip but it ensures that stripping of debug information is done first.

osgx
  • 90,338
  • 53
  • 357
  • 513