aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-10-18 00:25:53 +0000
committerCary Coutant <ccoutant@google.com>2011-10-18 00:25:53 +0000
commitf7c5b166f66958163526aa5688d8a7e3d0686694 (patch)
tree486d1a59c99520b4b72fb6d2913b3499c438d993
parent6ffe910a7e62888428dfe53168a5383dd3daf689 (diff)
downloadgdb-f7c5b166f66958163526aa5688d8a7e3d0686694.zip
gdb-f7c5b166f66958163526aa5688d8a7e3d0686694.tar.gz
gdb-f7c5b166f66958163526aa5688d8a7e3d0686694.tar.bz2
PR gold/13245
* plugin.cc (is_visible_from_outside): Check for symbols referenced from dynamic objects. * resolve.cc (Symbol_table::resolve): Don't count references from dynamic objects as references from real ELF files. * testsuite/plugin_test_2.sh: Adjust expected result.
-rw-r--r--gold/ChangeLog9
-rw-r--r--gold/plugin.cc6
-rw-r--r--gold/resolve.cc2
-rw-r--r--gold/symtab.h7
-rwxr-xr-xgold/testsuite/plugin_test_2.sh2
5 files changed, 22 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index f5ef533..1833996 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,14 @@
2011-10-17 Cary Coutant <ccoutant@google.com>
+ PR gold/13245
+ * plugin.cc (is_visible_from_outside): Check for symbols
+ referenced from dynamic objects.
+ * resolve.cc (Symbol_table::resolve): Don't count references
+ from dynamic objects as references from real ELF files.
+ * testsuite/plugin_test_2.sh: Adjust expected result.
+
+2011-10-17 Cary Coutant <ccoutant@google.com>
+
* gold.cc: Include timer.h.
(queue_middle_tasks): Stamp time.
(queue_final_tasks): Likewise.
diff --git a/gold/plugin.cc b/gold/plugin.cc
index ebda0af..637613c 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -818,7 +818,9 @@ Pluginobj::Pluginobj(const std::string& name, Input_file* input_file,
}
// Return TRUE if a defined symbol is referenced from outside the
-// universe of claimed objects.
+// universe of claimed objects. Only references from relocatable,
+// non-IR (unclaimed) objects count as a reference. References from
+// dynamic objects count only as "visible".
static inline bool
is_referenced_from_outside(Symbol* lsym)
@@ -838,6 +840,8 @@ is_referenced_from_outside(Symbol* lsym)
static inline bool
is_visible_from_outside(Symbol* lsym)
{
+ if (lsym->in_dyn())
+ return true;
if (parameters->options().export_dynamic() || parameters->options().shared())
return lsym->is_externally_visible();
return false;
diff --git a/gold/resolve.cc b/gold/resolve.cc
index 03288ec..2a68876 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -296,7 +296,7 @@ Symbol_table::resolve(Sized_symbol<size>* to,
// Record if we've seen this symbol in a real ELF object (i.e., the
// symbol is referenced from outside the world known to the plugin).
- if (object->pluginobj() == NULL)
+ if (object->pluginobj() == NULL && !object->is_dynamic())
to->set_in_real_elf();
// If we're processing replacement files, allow new symbols to override
diff --git a/gold/symtab.h b/gold/symtab.h
index b9b9e00..4707e12 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -993,7 +993,12 @@ class Symbol
// index, not one of the special codes from SHN_LORESERVE to
// SHN_HIRESERVE (bit 29).
bool is_ordinary_shndx_ : 1;
- // True if we've seen this symbol in a real ELF object (bit 30).
+ // True if we've seen this symbol in a "real" ELF object (bit 30).
+ // If the symbol has been seen in a relocatable, non-IR, object file,
+ // it's known to be referenced from outside the IR. A reference from
+ // a dynamic object doesn't count as a "real" ELF, and we'll simply
+ // mark the symbol as "visible" from outside the IR. The compiler
+ // can use this distinction to guide its handling of COMDAT symbols.
bool in_real_elf_ : 1;
// True if this symbol is defined in a section which was discarded
// (bit 31).
diff --git a/gold/testsuite/plugin_test_2.sh b/gold/testsuite/plugin_test_2.sh
index a47d22a..293b1f0 100755
--- a/gold/testsuite/plugin_test_2.sh
+++ b/gold/testsuite/plugin_test_2.sh
@@ -45,7 +45,7 @@ check plugin_test_2.err "two_file_test_main.o: claim file hook called"
check plugin_test_2.err "two_file_test_1.syms: claim file hook called"
check plugin_test_2.err "two_file_test_1b.syms: claim file hook called"
check plugin_test_2.err "two_file_shared_2.so: claim file hook called"
-check plugin_test_2.err "two_file_test_1.syms: _Z4f13iv: PREVAILING_DEF_REG"
+check plugin_test_2.err "two_file_test_1.syms: _Z4f13iv: PREVAILING_DEF_IRONLY_EXP"
check plugin_test_2.err "two_file_test_1.syms: _Z2t2v: PREVAILING_DEF_REG"
check plugin_test_2.err "two_file_test_1.syms: v2: RESOLVED_DYN"
check plugin_test_2.err "two_file_test_1.syms: t17data: RESOLVED_DYN"