28

Could anyone please explain me whats the actual difference between a stripped and a non-stripped binary in Linux ?

After a little bit of googling, I found that non-stripped binary contains the debugging info and stripped binary does'nt.

2
  • 1
    It seems like you got your answer when you googled. What more do you need to know?
    – Barmar
    Mar 27, 2014 at 8:39
  • 3
    @Barmar This is now the top answer on Google. Feb 15, 2017 at 8:55

1 Answer 1

25

Although you have found your answer from the Google. Just putting that , non-stripped binaries have debugging information built into it. So if you compile an executable with gcc's -g flag, it contains debugging information. Whereas Strip binaries generally remove this debugging information from the exe which is not necessary for execution so as to reduce the size of the exe.

3
  • Thank you for your response. So, how do i remove debugging information from an executable compiled with gcc's -g flag ?
    – Droider
    Mar 27, 2014 at 8:49
  • 2
    @Droider:- strip is something which can be run on an object file which is already compiled. It also has a variety of command-line options which you can use to configure which information will be removed. For example, -g strips only the debug information which gcc -g adds. gcc -s: Remove all symbol table and relocation information from the executable. strip: Discard symbols from object files. Mar 27, 2014 at 8:50
  • What symbol table are symbols removed from?
    – 425nesp
    Nov 8, 2022 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.