Re: GCC Build Defaults to Debug Mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 11/01/17 17:21, Nick wrote:
>>> 3.  How best to turn it off?
>>
>> It'd probably be best to strip out the debuginfo into a separate file.
>>
>>    <Run "objcopy --only-keep-debug foo foo.dbg" to>
>>        create a file containing the debugging info.
>>
>>    <Run "objcopy --strip-debug foo" to create a>
>>        stripped executable.
>>
>>    <Run "objcopy --add-gnu-debuglink=foo.dbg foo">
>>        to add a link to the debugging info into the stripped
>>        executable.
>>
> 
> Stripping the debug info, while possible, might be tricky because I
> don't necessarily know all the files from GCC which get linked into my
> app.  And while I can try to find them now, I worry that over time
> others might get linked in.  I don't suppose there's an easy way to
> systematically strip it out from all libs that GCC produces (ie. without
> necessarily specifying each obj or lib file)?

Surely it's a 15-minute job to write a find script.  Although, yeah,
they always take longer than I expect, but this is a really easy
job.

> I tried to build GCC specifying CFLAGS, CXXFLAGS, and CPPFLAGS to either
> empty or "-O2" and regardless, "-g" gets added.  So I guess GCC is doing
> this internally.

No, it's in the makefiles, so it can be done.  But there are lots of
FLAGS variables in the scripts, and these will change with future
versions of GCC.  That's why post-processing is probably your best
bet.

Andrew.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux