Hession
Hession

Reputation: 31

why object file's debug_str so big?

enter image description here

i use [objdump XXX.o -Ws] output many string lines, they are all struct names in my other c++ head files, but some of them are repeated, make my XXX.o so big.

can anyone tell me, are the repeated struct names in debug_str required for gcc ? and is there some parameters of gcc to reduce the repeated string? thanks.

Upvotes: 0

Views: 1076

Answers (1)

nos
nos

Reputation: 229244

can anyone tell me, are the repeated struct names in debug_str required for gcc ?

Yes, they are required if you want to debug your program in a friendly way.

and is there some parameters of gcc to reduce the repeated string? thanks. Not directly, no.

You can remove the -g or similar arguments when you compile. Though that will not make source level debugging possible anymore.

You can also remove that information yourself, by running the strip -g command on your binary or object files.

Remember that this is debug information, used by a debugger. That information is not loaded or used when running your program normally.

Upvotes: 2

Related Questions