From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sourceware.org, gdb-patches@sourceware.org
Subject: linker debug info editing
Date: Fri, 10 Mar 2006 19:44:00 -0000 [thread overview]
Message-ID: <20060310124921.GN6777@bubble.grove.modra.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]
This is a first pass at debug info editing to remove bogus entries for
link-once functions. I'm not going to commit it just yet as the only
testing I've done is linking a current libstdc++ and examining the
results with readelf, and there are some as yet unresolved issues.
I'm posting now because I'd like some feedback/review, particularly on
the overall design assumptions as detailed in the following comment.
Another thing I'm unsure of at this point is whether I should remove
the CU header when all following info is removed in .debug_info,
.debug_line, and .debug_aranges sections. I know one consumer (readelf)
became confused when .debug_aranges had an empty unit. Perhaps other
consumers expect some relationship between the number of CUs in
different debug sections?
One known issue is that .debug_pubnames and .debug_pubtypes have a
debug_info_length field, and I guess I need to edit this when shrinking
.debug_info.
/* This file implements removal of DIEs for discarded link-once sections.
Such DIEs are detected by parsing debug sections to find DIE boundaries,
then examining relocations for each DIE. Any DIE containing a field
with a relocation against a symbol in a discarded section is marked for
removal. A removed DIE in .debug_info results in all of its children
and associated data in .debug_loc and .debug_ranges being removed too.
A removed CIE in .debug_frame results in all FDEs using that CIE
being removed, but no attempt is made to remove usused CIEs (as can
happen when all of a CIE's FDEs are removed). Likewise, other unused
shared info, ie. .debug_abbrev and .debug_str entries, are not removed.
We assume that
a) debug section relocations are sorted by r_offset,
b) .debug_info location lists (references to .debug_loc) occur
in increasing order of offset into .debug_loc,
c) .debug_info ranges (references to .debug_ranges) occur
in increasing order of offset into .debug_ranges,
d) entries in .debug_loc and .debug_ranges are not shared,
e) FDEs always occur at higher offsets than their associated CIEs
in .debug_frame.
ld -r using perverse linker scripts can break the first three
assumptions. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre
[-- Attachment #2: debug.diff.gz --]
[-- Type: application/x-gunzip, Size: 15823 bytes --]
next reply other threads:[~2006-03-10 12:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-10 19:44 Alan Modra [this message]
2006-03-10 20:06 ` James E Wilson
2006-03-10 20:16 ` Daniel Jacobowitz
2006-03-12 7:58 ` Jim Blandy
2006-03-13 12:53 ` Daniel Berlin
2006-03-13 20:19 ` Alan Modra
2006-03-14 15:10 ` Daniel Berlin
2006-03-13 4:59 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060310124921.GN6777@bubble.grove.modra.org \
--to=amodra@bigpond.net.au \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox