LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-27-2006, 08:38 AM   #1
George2
Member
 
Registered: Oct 2003
Posts: 354

Rep: Reputation: 30
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
 
Old 08-27-2006, 09:23 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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.
 
Old 08-28-2006, 03:49 AM   #3
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
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
 
Old 08-28-2006, 11:22 AM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
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.
 
Old 08-28-2006, 11:36 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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 ...
 
Old 08-28-2006, 12:08 PM   #6
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
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
 
Old 08-28-2006, 12:10 PM   #7
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
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
 
Old 08-28-2006, 02:52 PM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
They are only unnecessary for executing the program, but they are very valuable for post mortem crash analysis and debug.
 
Old 08-29-2006, 09:55 AM   #9
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
id3lib Strip? bendeco13 Programming 0 04-04-2006 03:10 AM
strip -s blackzone Linux - Newbie 1 09-01-2004 01:08 AM
strip command? blackzone Linux - General 2 07-09-2004 04:20 AM
Why strip binaries? rsamurti Slackware 4 06-27-2004 05:17 PM
strip poker JROCK1980 Linux - Games 7 04-10-2004 01:40 AM


All times are GMT -5. The time now is 01:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration