LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   about strip (https://www.linuxquestions.org/questions/programming-9/about-strip-477767/)

George2 08-27-2006 07:38 AM

about strip
 
Hello everyone,


Could anyone show me how to use strip under Linux, for example, strip -s. I have read the Linux man manual of strip, but more confused after reading it.

I am also wondering in what situations do you use it?


thanks in advance,
George

jlliagre 08-27-2006 08:23 AM

Quote:

Originally Posted by George2
Could anyone show me how to use strip under Linux, for example, strip -s.

strip -s file
Quote:

I have read the Linux man manual of strip, but more confused after reading it.
What part is confusing you ?
Quote:

I am also wondering in what situations do you use it?
Here are two use cases:
you want your binary file to be smaller in size.
you want to hide symbols from a proprietary program to make reverse engineering more difficult.

George2 08-28-2006 02:49 AM

Thank you jlliagre,


Quote:

Originally Posted by jlliagre
strip -s file

What part is confusing you ?

Here are two use cases:
you want your binary file to be smaller in size.
you want to hide symbols from a proprietary program to make reverse engineering more difficult.

What makes me confused is that, in the man page, it is mentioned that strip -s will remove all symbols. I do not know what are the symbols in the context, but if they are exported symbols (functions/variables), and when they are removed, how could other module use the exported functions/variables?


regards,
George

jim mcnamara 08-28-2006 10:22 AM

He means that strip removes a human readable symbol table - like the one you see with
Code:

nm filename
A long time ago, stripped executables loaded and ran faster than the same file that was not stripped. Today, you might strip files to make them smaller for a distribution package.

jlliagre 08-28-2006 10:36 AM

Indeed, either the manual page is wrong or an object would be made unusable after "strip -s".

I'll let you test which one is true. I would tend to believe it is the former, and only unnecessary symbol are stripped, but who knows ...

George2 08-28-2006 11:08 AM

Thank you Jim!


Quote:

Originally Posted by jim mcnamara
He means that strip removes a human readable symbol table - like the one you see with
Code:

nm filename
A long time ago, stripped executables loaded and ran faster than the same file that was not stripped. Today, you might strip files to make them smaller for a distribution package.

If I make a debug mode build of application, then if I remove such symbol table, could the debugger work properly? Because I think without a human readable information symbol table, how could the person who makes the debug assignment know the meaning of each internal symbol?


regards,
George

George2 08-28-2006 11:10 AM

Hi jlliagre,


Quote:

Originally Posted by jlliagre
Indeed, either the manual page is wrong or an object would be made unusable after "strip -s".

I'll let you test which one is true. I would tend to believe it is the former, and only unnecessary symbol are stripped, but who knows ...

If they are unnecessary as you mentioned, why could compiler/linker generate such unnecessary symbol table?


regards,
George

jlliagre 08-28-2006 01:52 PM

They are only unnecessary for executing the program, but they are very valuable for post mortem crash analysis and debug.

jim mcnamara 08-29-2006 08:55 AM

It's a value call- unstripped image files use more space and some more memory, but you need them when things go bad, like for core analysis with gdb.

strip is there because strip has been part of UNIX for looong time. It's utility is simply how you perceive it: strip is good or strip is bad or strip is neutral.


All times are GMT -5. The time now is 06:43 AM.