aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-23 23:46:55 +0000
committerCary Coutant <ccoutant@google.com>2008-12-23 23:46:55 +0000
commitd66a9eb3f048c2143a5281fb967255b9445fb961 (patch)
tree1c2dcb19d7be7cf85c2621eb520c864977092c9c /gold/plugin.cc
parent84e94c9023c5d75f0ab10f9aa572003f9612b6ab (diff)
downloadgdb-d66a9eb3f048c2143a5281fb967255b9445fb961.zip
gdb-d66a9eb3f048c2143a5281fb967255b9445fb961.tar.gz
gdb-d66a9eb3f048c2143a5281fb967255b9445fb961.tar.bz2
* plugin.cc (is_visible_from_outside): New function.
(Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside so we don't return "IR only" status for exported symbols or -r links. * testsuite/Makefile.am (plugin_test_3): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test_3.sh: New file.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 498b344..c624ef1 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -372,6 +372,21 @@ Pluginobj::Pluginobj(const std::string& name, Input_file* input_file,
{
}
+// Return TRUE if a defined symbol might be reachable from outside the
+// universe of claimed objects.
+
+static inline bool
+is_visible_from_outside(Symbol* lsym)
+{
+ if (lsym->in_real_elf())
+ return true;
+ if (parameters->options().relocatable())
+ return true;
+ if (parameters->options().export_dynamic() || parameters->options().shared())
+ return lsym->is_externally_visible();
+ return false;
+}
+
// Get symbol resolution info.
ld_plugin_status
@@ -408,7 +423,7 @@ Pluginobj::get_symbol_resolution_info(int nsyms, ld_plugin_symbol* syms) const
if (lsym->source() != Symbol::FROM_OBJECT)
res = LDPR_PREEMPTED_REG;
else if (lsym->object() == static_cast<const Object*>(this))
- res = (lsym->in_real_elf()
+ res = (is_visible_from_outside(lsym)
? LDPR_PREVAILING_DEF
: LDPR_PREVAILING_DEF_IRONLY);
else