In this video, we'll be looking into what is the functionality provided by the strip command.
So strip command discards symbols from the object files.
And this command is often used to reduce the size of the binary before it is shipped to the customers.
So, uh, let's see what happens when you use strip command.
So I have this, uh, simple executable again, the same example which I'm using now I'm printing like
this one.
It has symbol table which contains information about the.
Symbols, and the strings of the symbol table is present in the string table.
It is not having dynamic symbol table, or it is not having dim string dim dynamic string table right.
It is only having sym tab.
It is not having d I n d y n str.
So now if I say file on this user space dot zero, it is saying it is not stripped.
Now I run the strip command on this Joe space dot o.
Now when I say file now it is saying it is stripped.
What does mean strip?
Now when I say read elf on this you can see the number of sections have been reduced like 11 sections.
Now previously we had 16 sections, so it has reduced few sections.
It has removed.
We don't have sym table, symbol table, string table.
These two sections have been gone from this right.
And there should be some other sections which have been also gone.
We can compare this in a by keeping to two text files and compare it.
We have text all the relay.
This information is gone.
Relocation information.
The text databases are also present.
Again this information is gone.
So when I run strip command it is removing some of the sections.
Especially it is removing the symbol table and string table from the Elf sections.
And now we have this one file on user space.
It is also not stripped.
So now when I say read elf on this it is having like symbol table, string table, dynamic symbol table
and dynamic string.
Now when I run the strip command on this and as a file user space, it is saying stripped.
Now when I say read elf on AWS, it is having now only few sections.
The symbol table section is gone, but the dynamic symbol table is not removed.
So strip command will not remove this because this is needed during loading stage.
This is allocated from the memory as well, so this is not removed.
It only removes the global string table.
It will not remove the dynamic symbol table.
It will remove only the global string table.