diff options
author | marxin <mliska@suse.cz> | 2019-03-26 10:40:04 +0100 |
---|---|---|
committer | marxin <mliska@suse.cz> | 2019-03-26 15:22:01 +0100 |
commit | 7ea79cb3affe1ae1d196f511ace044c015e0ccd3 (patch) | |
tree | 6c28f5c6c7590571d94fd1108d20358223403ec1 | |
parent | 5fb812fc79a37b0d02f4902456c6f87ce9896a8d (diff) | |
download | gdb-7ea79cb3affe1ae1d196f511ace044c015e0ccd3.zip gdb-7ea79cb3affe1ae1d196f511ace044c015e0ccd3.tar.gz gdb-7ea79cb3affe1ae1d196f511ace044c015e0ccd3.tar.bz2 |
Provide string description of definition, visibility and resolution in LTO plug-in.
ld/ChangeLog:
2019-02-26 Martin Liska <mliska@suse.cz>
* plugin.c (get_symbols): Add lto_kind_str, lto_resolution_str,
lto_visibility_str and use then to inform about plugin-symbols.
* testsuite/ld-plugin/plugin-12.d: Adjust expected pattern.
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/plugin.c | 73 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/plugin-12.d | 8 |
3 files changed, 81 insertions, 6 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 0029150..da1e8e1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2019-03-26 Martin Liska <mliska@suse.cz> + + * plugin.c (get_symbols): Add lto_kind_str, lto_resolution_str, + lto_visibility_str and use then to inform about plugin-symbols. + * testsuite/ld-plugin/plugin-12.d: Adjust expected pattern. + 2019-03-25 Tamar Christina <tamar.christina@arm.com> * testsuite/ld-arm/jump-reloc-veneers-cond-long.d: Update disassembly. diff --git a/ld/plugin.c b/ld/plugin.c index ea1a7f7..0e15654 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -659,6 +659,73 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym, return FALSE; } +/* Return LTO kind string name that corresponds to INDEX enum value. */ +static const char * +get_lto_kind (unsigned int index) +{ + static char buffer[64]; + const char *lto_kind_str[5] = + { + "DEF", + "WEAKDEF", + "UNDEF", + "WEAKUNDEF", + "COMMON" + }; + + if (index < ARRAY_SIZE (lto_kind_str)) + return lto_kind_str [index]; + + sprintf (buffer, _("unknown LTO kind value %x"), index); + return buffer; +} + +/* Return LTO resolution string name that corresponds to INDEX enum value. */ +static const char * +get_lto_resolution (unsigned int index) +{ + static char buffer[64]; + static const char *lto_resolution_str[10] = + { + "UNKNOWN", + "UNDEF", + "PREVAILING_DEF", + "PREVAILING_DEF_IRONLY", + "PREEMPTED_REG", + "PREEMPTED_IR", + "RESOLVED_IR", + "RESOLVED_EXEC", + "RESOLVED_DYN", + "PREVAILING_DEF_IRONLY_EXP", + }; + + if (index < ARRAY_SIZE (lto_resolution_str)) + return lto_resolution_str [index]; + + sprintf (buffer, _("unknown LTO resolution value %x"), index); + return buffer; +} + +/* Return LTO visibility string name that corresponds to INDEX enum value. */ +static const char * +get_lto_visibility (unsigned int index) +{ + static char buffer[64]; + const char *lto_visibility_str[4] = + { + "DEFAULT", + "PROTECTED", + "INTERNAL", + "HIDDEN" + }; + + if (index < ARRAY_SIZE (lto_visibility_str)) + return lto_visibility_str [index]; + + sprintf (buffer, _("unknown LTO visibility value %x"), index); + return buffer; +} + /* Get the symbol resolution info for a plugin-claimed input file. */ static enum ld_plugin_status get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, @@ -777,9 +844,11 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, syms[n].resolution = res; if (report_plugin_symbols) einfo (_("%P: %pB: symbol `%s' " - "definition: %d, visibility: %d, resolution: %d\n"), + "definition: %s, visibility: %s, resolution: %s\n"), abfd, syms[n].name, - syms[n].def, syms[n].visibility, res); + get_lto_kind (syms[n].def), + get_lto_visibility (syms[n].visibility), + get_lto_resolution (res)); } return LDPS_OK; } diff --git a/ld/testsuite/ld-plugin/plugin-12.d b/ld/testsuite/ld-plugin/plugin-12.d index 10d7725..35eae1e 100644 --- a/ld/testsuite/ld-plugin/plugin-12.d +++ b/ld/testsuite/ld-plugin/plugin-12.d @@ -1,6 +1,6 @@ #... -.*: symbol `func' definition: 0, visibility: 0, resolution: 2 -.*: symbol `func1' definition: 0, visibility: 1, resolution: 3 -.*: symbol `func2' definition: 0, visibility: 2, resolution: 3 -.*: symbol `func3' definition: 0, visibility: 3, resolution: 3 +.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DEF +.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY +.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY +.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY #pass |