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

Alan Modra amodra@gmail.com
Wed May 13 00:05:06 GMT 2020


On Tue, May 12, 2020 at 09:08:17AM -0700, Douglas B Rupp wrote:
> I seek feedback on the attached patch, which enhances the .map file to show
> better address info on AIX XCOFF garbage collected symbols.

I think the patch is more generally useful, ie. does not need to be
specific to AIX.  Which means you can drop link_info.aix_gc.

> diff --git ld/ldlang.c ld/ldlang.c
> index 21ef9bea2b..b5b67b4df8 100644
> --- ld/ldlang.c
> +++ ld/ldlang.c
> @@ -4140,6 +4140,11 @@ print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr)
>  	      + hash_entry->u.def.section->output_offset
>  	      + hash_entry->u.def.section->output_section->vma));
>  
> +      if (link_info.aix_gc && hash_entry->u.def.section->size == 0)

This line should then be something like
     if (discarded_section (sec))
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..

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").

> +	minfo (" -->gc 0x%V   ",
> +	       (hash_entry->u.def.section->output_offset
> +                + hash_entry->u.def.section->output_section->vma));
> +
>        minfo ("             %pT\n", hash_entry->root.string);
>      }
>  


-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list