On Wed, 2017-01-11 at 16:46 +0000, Andrew Haley wrote: Thanks for the quick reply & info Andrew. > > 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)? 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.