[Gllug] Getting technical about email

Nix nix at esperi.org.uk
Sat Nov 11 12:57:03 UTC 2006


On 11 Nov 2006, Mike Brodbelt outgrape:

> Nix wrote:
>> 
>> Debug symbols are stored in sections which are not mapped to segments,
>> so they are never loaded (except by the debugger, which digs around
>> inside the binary directly, using libbfd).
>
> That's interesting - I'd assumed they were mapped. In that case their
> only negative would be the disk overhead, and presumably a small
> (probably insignificant) performance degradation due to the ELF loader
> doing its thing?

There's no overhead to speak of, other than the extra time taken to
load the larger list of ELF sections out of the ELF header (ignorable
and utterly drowned by symbol lookup and relocation overhead anyway).

It is a GCC bug if -g causes *any* change in code generation, so other
than debug sections appearing it should have no effect, ever.

One downside is that in order to get backtraces in all but the most
recent bleeding-edge CVS GDB, you need frame pointers, and
-fno-omit-frame-pointer incurs such an overhead on register-poor
architectures like IA32 that the default will soon be switched to off,
as soon as a version of GDB is released that can parse DWARF2's location
lists instead of relying on stack frame parsing. I hope Debian strip
by default, really.

FWIW my current non-debugging flags assuming an old GDB (yes, I check
GDB versions in my site-config script and the script that runs to
generate variable-assignment fragments for non-autoconf platforms: if a
new GDB is in use I compile with debugging and split the debugging info
into a separate file via a wrapper around ld) are now

CFLAGS="-O2 -fomit-frame-pointer -march=athlon-4 -pipe -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -ffast-math"
CXXFLAGS=$CFLAGS
LDFLAGS=" -s -Wl,--enable-new-dtags -Wl,--hash-style=gnu -Wl,-O1 -Wl,-z,relro"


(--enable-new-dtags requires glibc >2.2; --relro requires new binutils;
--hash-style=gnu requires CVS binutils and glibc 2.5. All three are the
default in FC6, except that they use --hash-style=both to allow
portability to systems using glibc 2.3 and above while still emitting
DT_GNU_HASH to improve unprelinked relocation time with glibc 2.5. This
is reasonably practical these days because there are very few new
versions of old symbols in glibc 2.4 and 2.5.)

-- 
Rich industrial heritage: lifeless wasteland. `The land
north of Mordor has a rich industrial heritage.'
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list