aboutsummaryrefslogtreecommitdiff
path: root/gold/resolve.cc
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-08-28 08:05:04 +0000
committerDoug Kwan <dougkwan@google.com>2010-08-28 08:05:04 +0000
commita464928644b6811cfa7a7de2652d3eb00fe75f6d (patch)
tree297c6e9987fd140ff1627afa5c020b26d22f23b4 /gold/resolve.cc
parent89a2ee5a089604df716321acbc40137ef408afe8 (diff)
downloadgdb-a464928644b6811cfa7a7de2652d3eb00fe75f6d.zip
gdb-a464928644b6811cfa7a7de2652d3eb00fe75f6d.tar.gz
gdb-a464928644b6811cfa7a7de2652d3eb00fe75f6d.tar.bz2
2010-08-27 Doug Kwan <dougkwan@google.com>
* gold/resolve.cc (Symbol_table::should_override): Let a weak reference override an existing dynamic weak reference. * testsuite/Makefile.am: Add new test dyn_weak_ref. * testsuite/Makefile.in: Regenerate. * testsuite/dyn_weak_ref.sh: New file. * testsuite/dyn_weak_ref_1.c: Ditto. * testsuite/dyn_weak_ref_2.c: Ditto.
Diffstat (limited to 'gold/resolve.cc')
-rw-r--r--gold/resolve.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/gold/resolve.cc b/gold/resolve.cc
index 29d9d79..4864f1e 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -630,14 +630,21 @@ Symbol_table::should_override(const Symbol* to, unsigned int frombits,
case UNDEF * 16 + WEAK_UNDEF:
case WEAK_UNDEF * 16 + WEAK_UNDEF:
case DYN_UNDEF * 16 + WEAK_UNDEF:
- case DYN_WEAK_UNDEF * 16 + WEAK_UNDEF:
case COMMON * 16 + WEAK_UNDEF:
case WEAK_COMMON * 16 + WEAK_UNDEF:
case DYN_COMMON * 16 + WEAK_UNDEF:
case DYN_WEAK_COMMON * 16 + WEAK_UNDEF:
- // A new weak undefined reference tells us nothing.
+ // A new weak undefined reference tells us nothing unless the
+ // exisiting symbol is a dynamic weak reference.
return false;
+ case DYN_WEAK_UNDEF * 16 + WEAK_UNDEF:
+ // A new weak reference overrides an existing dynamic weak reference.
+ // This is necessary because a dynamic weak reference remembers
+ // the old binding, which may not be weak. If we keeps the existing
+ // dynamic weak reference, the weakness may be dropped in the output.
+ return true;
+
case DYN_DEF * 16 + WEAK_UNDEF:
case DYN_WEAK_DEF * 16 + WEAK_UNDEF:
// For a dynamic def, we need to remember which kind of undef we see.