[RFA] Add stabs entries for coalesced symbols.

Klee Dienes klee@apple.com
Sun Nov 24 02:25:00 GMT 2002


[ I should first warn you that I'm by no means an authority on our 
implementation of coalesced symbols; my only real experience with them 
is teaching GDB to ignore them. ]


On Tuesday, November 19, 2002, at 01:23 AM, Ian Lance Taylor wrote:

> Coalesced symbols look quite similar to COMDAT sections (e.g.,
> SEC_LINK_DUPLICATES_DISCARD).  They're called coalesced *symbols*, but
> in BFD terminology they are really *sections*.  It would be nice if
> you mentioned this in your new documentation.  Thanks.

My understanding is that coalesced symbols are similar to, but not 
quite the same as COMDAT sections.  In our implementation, coalesced 
symbols are placed into sections marked with the S_COALESCED flag, each 
of which may contain any number of coalesced symbols.  I've tried to 
make the documentation reflect this a bit better (speaking of which, I 
should mention that these docs are extensively plagiarized from docs 
written by another engineer at Apple; I'm just adapting them as best I 
can from the release notes for use in the stabs document).

Are you saying that our BFD Mach-O layer should be mapping each symbol 
in a Mach-O coalesced section into a separate BFD section flagged with 
SEC_LINK_DUPLICATES_DISCARD?  Unfortunately, we haven't yet extended 
our BFD layer to anything beyond that needed to support GDB and 
objdump/objcopy/etc., but it would be nice to know how to proceed for 
future reference.


On Tuesday, November 19, 2002, at 01:59 AM, Eli Zaretskii wrote:

> Also, are coalesced symbols a MacOS-only feature, or are they supported
> (or can reasonably be expected to be supported in the future) on other
> platforms?  If the former, I think we should tell right at the start of
> this section that the information pertains only to the Mac.

There's no reason they couldn't be supported on other platforms, though 
it seems unlikely they would be (since I believe COMDAT sections serve 
the same purpose).  I thought that starting the section with "On Mac OS 
X" and including that in the menu entry was a reasonably clear way to 
mark the feature as Mac OS X -specific.  I'm certainly willing to 
include something stronger, but couldn't think of a way to do it that 
didn't seem awkward --- any suggestions?


On Tuesday, November 19, 2002, at 05:17 AM, Jim Blandy wrote:

> I have the impression that GDB doesn't need to know about these
> symbols, since the static linker has removed them by the time GDB sees
> the file.  If that's so, that should be stated explicitly.
>
> There must be more information in these stabs that allows the static
> linker to pair up a BNSYM..ENSYM region with its symbol in the
> coalesced section.  Whatever the case, the way the pairing is done
> should be explained in complete detail here.

Actually, the static linker leaves them in, so that they can be 
combined across shared libraries.  Once these patches are in, I'll be 
submitting patches to GDB to direct it to ignore BNSYM and ENSYM 
symbols.

I've tried to make the pairing algorithm a bit more clear; let me know 
if you think more is needed.

I'm also still looking for approval on the binutils portion; let me 
know if there are any issues there as well.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: coalesced-symbols.txt
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20021124/ba3da38b/attachment.txt>


More information about the Gdb-patches mailing list