Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc vs. clang: symbol stripping

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?

like image 500
Reinderien Avatar asked May 22 '11 01:05

Reinderien


People also ask

What is GCC strip?

gcc -s : Remove all symbol table and relocation information from the executable. strip : Discard symbols from object files.

What is strip command?

The strip command reduces the size of XCOFF object files. The strip command optionally removes the line number information, relocation information, the debug section, the typchk section, the comment section, file headers, and all or part of the symbol table from the XCOFF object files.

What is option in Clang?

clang supports the -std option, which changes what language mode clang uses. The supported modes for C are c89, gnu89, c94, c99, gnu99 and various aliases for those modes. If no -std option is specified, clang defaults to gnu99 mode.

What is Clang command?

The Clang tool is a front end compiler that is used to compile programming languages such as C++, C, Objective C++ and Objective C into machine code. Clang is also used as a compiler for frameworks like OpenMP, OpenCL, RenderScript, CUDA and HIP.


1 Answers

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.

like image 182
osgx Avatar answered Sep 21 '22 18:09

osgx