[PATCH] [2nd try] Show AIX gc'd symbol address adjustments in map file

Alan Modra amodra@gmail.com
Wed May 13 22:58:25 GMT 2020


On Wed, May 13, 2020 at 10:03:05AM -0700, Douglas B Rupp wrote:
> 
> On 5/12/20 5:05 PM, Alan Modra via Binutils wrote:
> > This line should then be something like
> >       if (discarded_section (sec))
> 
> This test was not revealing for a discarded symbol, it always came up as
> false in my testing.
> 
> Fyi: I'm using an old version of binutils (2.23.52.20130704) for testing
> (ultimately this is for a customer of ours who is required to use this
> version due to certification requirements).  That's not your problem of
> course, but I'm just mentioning it in case there's a version issue in play
> here.
> 
> My understanding of garbage collection is limited, but it seems to me that
> gc'd symbols and gc'd sections are apples and oranges, so I don't see how it
> will be possible to use a discarded section test.

Well, you were using a section test in your original patch,
u.def.section->size.  That's what sent me down this track.  A section
size test is definitely wrong as a means of distinguishing garbage
collected sections from other sections, since a zero sized section
that isn't garbage collected may well define a symbol (usually at the
beginning of that section).

By the look of xcoff_mark and xcoff_mark_symbol the direct test is
XCOFF_MARK in h->flags, but that's not so easy to do nicely from
ld/ldlang.c where we frown on including target specific headers.

> > or perhaps better, rather than using the bfd macro use the same
> > condition as in lang_map for config.print_map_discarded, to determine
> > discarded sections.  I'm presuming that those conditions actually work
> > for your "AIX XCOFF garbage collected symbols".  Maybe they won't..
> I think the same problem will apply here, and it's more difficult to test
> since print_map_discarded doesn't exist in older binutils and the target
> doesn't exist in newer binutils (ppc-lynx178).  Let me know if you think
> it's worth pursuing.
> > 
> > There's also the question of whether the extra symbol info is
> > appropriate when printing discarded sections to the map file.  I'd
> > think not.  To fix that you'll need to change the interface to
> > print_one_symbol so that the void* arg points at a struct containing
> > both the section pointer and print_input_section's "is_discarded"
> > parameter (which would better be renamed to "printing_discarded").
> 
> This issue is independent of the above.  I think it's interesting to know if
> a symbol has been gc'd, but the address info is redundant.  Something like
> this then?
> 
> .pr            0x00000000100012b0        0x0 ./pack1.o
>                 0x00000000100012b0   -->gc .pack1__fooIP
>                 0x00000000100012c0   -->gc .pack1__bumIP
> .pr            0x00000000100012b0       0x60 ./test1.o
> 
> > 

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list