diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-05-12 16:50:34 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-05-12 16:50:52 -0700 |
commit | 3355cb3b643bd50aafae768e7cf990d4bec40fe1 (patch) | |
tree | c16b986fd942a0b25ab494d5635d97d5fdd5de62 /ld/plugin.c | |
parent | 8ddd5a6cd692ca8c4041d9fb64cbb4e0585d4aa1 (diff) | |
download | gdb-3355cb3b643bd50aafae768e7cf990d4bec40fe1.zip gdb-3355cb3b643bd50aafae768e7cf990d4bec40fe1.tar.gz gdb-3355cb3b643bd50aafae768e7cf990d4bec40fe1.tar.bz2 |
Handle symbols defined/referenced only within IR
The plugin is called to claim symbols in an archive element from
plugin_object_p. But those symbols aren't needed to create output.
They are defined and referenced only within IR. get_symbols should
return resolution based on IR symbol kinds.
PR ld/20070
* Makefile.am (noinst_LTLIBRARIES): Add libldtestplug4.la.
(libldtestplug4_la_SOURCES): New.
(libldtestplug4_la_CFLAGS): Likewise.
(libldtestplug4_la_LDFLAGS): Likewise.
* Makefile.in: Regenerated.
* plugin.c (get_symbols): Return resolution based on IR symbol
kinds for symbols defined/referenced only within IR.
* testplug4.c: New file.
* ld/testsuite/ld-plugin/pr20070.d: Likewise.
* ld/testsuite/ld-plugin/pr20070a.c: Likewise.
* ld/testsuite/ld-plugin/pr20070b.c: Likewise.
* testsuite/ld-plugin/plugin.exp (plugin4_name): New.
(plugin4_path): Likewise.
Add a test for ld/20070.
Diffstat (limited to 'ld/plugin.c')
-rw-r--r-- | ld/plugin.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ld/plugin.c b/ld/plugin.c index bf66f52..a60ffca 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -674,7 +674,24 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, syms[n].name, FALSE, FALSE, TRUE); if (!blhe) { - res = LDPR_UNKNOWN; + /* The plugin is called to claim symbols in an archive element + from plugin_object_p. But those symbols aren't needed to + create output. They are defined and referenced only within + IR. */ + switch (syms[n].def) + { + default: + abort (); + case LDPK_UNDEF: + case LDPK_WEAKUNDEF: + res = LDPR_UNDEF; + break; + case LDPK_DEF: + case LDPK_WEAKDEF: + case LDPK_COMMON: + res = LDPR_PREVAILING_DEF_IRONLY; + break; + } goto report_symbol; } |