Hi, Maybe you can use -gtoggle for building without debug information. See gcc/config/bootstrap-debug.mk where -gtoggle is used to ensure that the same machine code is generated for builds with and without debug info. Dominik > On 11 Jan 2017, at 18:40, Andrew Haley <aph@xxxxxxxxxx> wrote: > > 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.
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail