8

i try to remove a symbol from object file as below:

gcc -c test.c 

strip --strip-symbol=test_sym test.o test.o

test_sym is a function implemented in test.c.

strip returns following message :

strip: not stripping symbol 'test_sym' because it is named in a relocation.

That error arise since the symbol is implemented in the same file. However is there a way to remove that symbol ?

Jérôme
  • 8,016
  • 4
  • 29
  • 35
RedArrow
  • 588
  • 8
  • 18
  • If you don't need the symbol to be externally visible, you can declare the function as `static`. – s7amuser Jun 16 '16 at 11:53
  • my aim is to do that task without any change on source code – RedArrow Jun 16 '16 at 11:54
  • 1
    OK, so see [this](http://stackoverflow.com/questions/23678896/limiting-the-scope-of-global-symbols-from-linked-objects). – s7amuser Jun 16 '16 at 11:56
  • my friend i tried that link before. But my problem : try to make undefine implemented symbol in object file. Becuase defined symbol cannot be stripped by strip. Linker definitions work for undefined symbol linking process and restrict libraries symbols usage by localalize or hidden them, then link process skip those library symbols. – RedArrow Jun 16 '16 at 12:06

0 Answers0