Show AIX gc'd symbol address adjustments in map file
* ldemul.h (ldemul_print_symbol): New. (ld_emulation_xfer_type) <print_symbol): Likewise. * ldemul.c (ldemul_print_symbol): New. * ldlang.c (SECTION_NAME_MAP_LANGTH): Move to ... (print_one_symbol): Make global and move declaration to ... (print_all_symbols): Rename print_one_symbol to ldemul_print_symbol (print_input_section): Likewise * ldlang.h: ... here. * emultempl/aix.em (gld${EMULATION_NAME}_print_symbol): New. (ld_emulation_xfer_struct): Use it. * emultempl/armcoff.em (ld_emulation_xfer_struct): Add print_symbol and default to NULL. * emultempl/beos.em (ld_emulation_xfer_struct): Likewise * emultempl/elf.em (ld_emulation_xfer_struct): Likewise * emultempl/generic.em (ld_emulation_xfer_struct): Likewise * emultempl/linux.em (ld_emulation_xfer_struct): Likewise * emultempl/msp430.em (ld_emulation_xfer_struct): Likewise * emultempl/pe.em (ld_emulation_xfer_struct): Likewise * emultempl/pep.em (ld_emulation_xfer_struct): Likewise * emultempl/ticoff.em (ld_emulation_xfer_struct): Likewise * emultempl/vanilla.em (ld_emulation_xfer_struct): Likewise
This commit is contained in:
parent
6e0c75f7c4
commit
3edf7b9f2c
24
ld/ChangeLog
24
ld/ChangeLog
@ -1,3 +1,27 @@
|
||||
2020-05-18 Douglas B Rupp <rupp@adacore.com>
|
||||
|
||||
* ldemul.h (ldemul_print_symbol): New.
|
||||
(ld_emulation_xfer_type) <print_symbol): Likewise.
|
||||
* ldemul.c (ldemul_print_symbol): New.
|
||||
* ldlang.c (SECTION_NAME_MAP_LANGTH): Move to ...
|
||||
(print_one_symbol): Make global and move declaration to ...
|
||||
(print_all_symbols): Rename print_one_symbol to ldemul_print_symbol
|
||||
(print_input_section): Likewise
|
||||
* ldlang.h: ... here.
|
||||
* emultempl/aix.em (gld${EMULATION_NAME}_print_symbol): New.
|
||||
(ld_emulation_xfer_struct): Use it.
|
||||
* emultempl/armcoff.em (ld_emulation_xfer_struct): Add print_symbol
|
||||
and default to NULL.
|
||||
* emultempl/beos.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/elf.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/generic.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/linux.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/msp430.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/pe.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/pep.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/ticoff.em (ld_emulation_xfer_struct): Likewise
|
||||
* emultempl/vanilla.em (ld_emulation_xfer_struct): Likewise
|
||||
|
||||
2020-05-18 Sergei Trofimovich <siarheit@google.com>
|
||||
|
||||
* ldmain.c (add_archive_element): Fix s/claimi/claim/ typo
|
||||
|
@ -1534,6 +1534,36 @@ gld${EMULATION_NAME}_open_dynamic_archive (const char *arch,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
gld${EMULATION_NAME}_print_symbol (struct bfd_link_hash_entry *hash_entry,
|
||||
void *ptr)
|
||||
{
|
||||
asection *sec = (asection *) ptr;
|
||||
|
||||
if ((hash_entry->type == bfd_link_hash_defined
|
||||
|| hash_entry->type == bfd_link_hash_defweak)
|
||||
&& sec == hash_entry->u.def.section)
|
||||
{
|
||||
int i;
|
||||
struct xcoff_link_hash_entry *h;
|
||||
|
||||
for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
|
||||
print_space ();
|
||||
minfo ("0x%V ",
|
||||
(hash_entry->u.def.value
|
||||
+ hash_entry->u.def.section->output_offset
|
||||
+ hash_entry->u.def.section->output_section->vma));
|
||||
|
||||
/* Flag symbol if it has been garbage collected. */
|
||||
h = (struct xcoff_link_hash_entry *) hash_entry;
|
||||
if ((h != NULL) && !(h->flags & XCOFF_MARK))
|
||||
minfo (" -->gc");
|
||||
minfo (" %pT\n", hash_entry->root.string);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
|
||||
gld${EMULATION_NAME}_before_parse,
|
||||
syslib_default,
|
||||
@ -1564,6 +1594,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL, /* extra_map_file_text */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
gld${EMULATION_NAME}_print_symbol
|
||||
};
|
||||
EOF
|
||||
|
@ -286,6 +286,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL, /* extra_map_file_text */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -786,6 +786,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL, /* extra_map_file_text */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -903,6 +903,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
${LDEMUL_NEW_VERS_PATTERN-NULL},
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -161,6 +161,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
${LDEMUL_NEW_VERS_PATTERN-NULL},
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -213,6 +213,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL, /* extra_map_file_text */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -848,7 +848,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
${LDEMUL_NEW_VERS_PATTERN-NULL},
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
#
|
||||
|
@ -2394,6 +2394,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* new_vers_pattern. */
|
||||
NULL, /* extra_map_file_text. */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -2192,6 +2192,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* new_vers_pattern. */
|
||||
NULL, /* extra_map_file_text */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -186,6 +186,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL, /* extra_map_file_text */
|
||||
${LDEMUL_EMIT_CTF_EARLY-NULL},
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}
|
||||
${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL},
|
||||
${LDEMUL_PRINT_SYMBOL-NULL}
|
||||
};
|
||||
EOF
|
||||
|
@ -87,6 +87,7 @@ struct ld_emulation_xfer_struct ld_vanilla_emulation =
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL, /* emit_ctf_early */
|
||||
NULL /* examine_strtab_for_ctf */
|
||||
NULL, /* examine_strtab_for_ctf */
|
||||
NULL /* print_symbol */
|
||||
};
|
||||
EOF
|
||||
|
@ -428,3 +428,11 @@ ldemul_examine_strtab_for_ctf (struct ctf_file *ctf_output,
|
||||
ld_emulation->examine_strtab_for_ctf (ctf_output, syms,
|
||||
symcount, symstrtab);
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
ldemul_print_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr)
|
||||
{
|
||||
if (ld_emulation->print_symbol)
|
||||
return ld_emulation->print_symbol (hash_entry, ptr);
|
||||
return print_one_symbol (hash_entry, ptr);
|
||||
}
|
||||
|
@ -112,6 +112,8 @@ extern int ldemul_emit_ctf_early
|
||||
extern void ldemul_examine_strtab_for_ctf
|
||||
(struct ctf_file *, struct elf_sym_strtab *, bfd_size_type,
|
||||
struct elf_strtab_hash *);
|
||||
extern bfd_boolean ldemul_print_symbol
|
||||
(struct bfd_link_hash_entry *hash_entry, void *ptr);
|
||||
|
||||
typedef struct ld_emulation_xfer_struct {
|
||||
/* Run before parsing the command line and script file.
|
||||
@ -236,6 +238,12 @@ typedef struct ld_emulation_xfer_struct {
|
||||
bfd_link_callback is invoked by per-target code. */
|
||||
void (*examine_strtab_for_ctf) (struct ctf_file *, struct elf_sym_strtab *,
|
||||
bfd_size_type, struct elf_strtab_hash *);
|
||||
|
||||
/* Called when printing a symbol to the map file. AIX uses this
|
||||
hook to flag gc'd symbols. */
|
||||
bfd_boolean (*print_symbol)
|
||||
(struct bfd_link_hash_entry *hash_entry, void *ptr);
|
||||
|
||||
} ld_emulation_xfer_type;
|
||||
|
||||
typedef enum {
|
||||
|
@ -155,8 +155,6 @@ static int lang_sizing_iteration = 0;
|
||||
#define outside_symbol_address(q) \
|
||||
((q)->value + outside_section_address (q->section))
|
||||
|
||||
#define SECTION_NAME_MAP_LENGTH (16)
|
||||
|
||||
/* CTF sections smaller than this are not compressed: compression of
|
||||
dictionaries this small doesn't gain much, and this lets consumers mmap the
|
||||
sections directly out of the ELF file and use them with no decompression
|
||||
@ -4619,7 +4617,7 @@ print_input_statement (lang_input_statement_type *statm)
|
||||
/* Print all symbols defined in a particular section. This is called
|
||||
via bfd_link_hash_traverse, or by print_all_symbols. */
|
||||
|
||||
static bfd_boolean
|
||||
bfd_boolean
|
||||
print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr)
|
||||
{
|
||||
asection *sec = (asection *) ptr;
|
||||
@ -4683,7 +4681,7 @@ print_all_symbols (asection *sec)
|
||||
|
||||
/* Print the symbols. */
|
||||
for (i = 0; i < ud->map_symbol_def_count; i++)
|
||||
print_one_symbol (entries[i], sec);
|
||||
ldemul_print_symbol (entries[i], sec);
|
||||
|
||||
obstack_free (&map_obstack, entries);
|
||||
}
|
||||
@ -4747,7 +4745,7 @@ print_input_section (asection *i, bfd_boolean is_discarded)
|
||||
&& i->output_section->owner == link_info.output_bfd)
|
||||
{
|
||||
if (link_info.reduce_memory_overheads)
|
||||
bfd_link_hash_traverse (link_info.hash, print_one_symbol, i);
|
||||
bfd_link_hash_traverse (link_info.hash, ldemul_print_symbol, i);
|
||||
else
|
||||
print_all_symbols (i);
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#define DEFAULT_MEMORY_REGION "*default*"
|
||||
|
||||
#define SECTION_NAME_MAP_LENGTH (16)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
lang_input_file_is_l_enum,
|
||||
@ -701,4 +703,7 @@ lang_print_memory_usage (void);
|
||||
extern void
|
||||
lang_add_gc_name (const char *);
|
||||
|
||||
extern bfd_boolean
|
||||
print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user