Henk Schurink
Henk Schurink

Reputation: 429

GCC: don't include system information in shared object

I am building a simple library in C and compiling it with gcc

gcc -c lib.c -o lib.o
gcc -shared -o lib.so lib.o

If I inspect the shared object with objdump or xxd, the following appears:

GCC: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

Is there an option to exclude this information?

Upvotes: 1

Views: 32

Answers (1)

Petr Skocik
Petr Skocik

Reputation: 60068

You can remove it after the fact with objcopy:

$ objcopy --remove-section .comment lib.so

Upvotes: 1

Related Questions