2020-05-12 Douglas B Rupp * include/bfdlink.h (aix_gc): New boolean * ld/emultempl/aix.em (gld${EMULATION_NAME}_add_options): Set it. * ld/ldlang.c (print_one_symbol): Output gc'd symbol info to map file diff --git include/bfdlink.h include/bfdlink.h index 773407f861..e00b6fcd76 100644 --- include/bfdlink.h +++ include/bfdlink.h @@ -498,6 +498,9 @@ struct bfd_link_info /* TRUE if common symbols should be treated as undefined. */ unsigned int inhibit_common_definition : 1; + /* TRUE if AIX style XCOFF garbage collection is ok. */ + unsigned int aix_gc: 1; + /* The 1-byte NOP for x86 call instruction. */ char call_nop_byte; diff --git ld/emultempl/aix.em ld/emultempl/aix.em index 92f59f28ed..b9145c2d6f 100644 --- ld/emultempl/aix.em +++ ld/emultempl/aix.em @@ -271,6 +271,8 @@ gld${EMULATION_NAME}_add_options *longopts = xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long)); memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long)); + + link_info.aix_gc = TRUE; } static bfd_boolean 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) + 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); }