aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-04-17 00:14:36 +0000
committerCary Coutant <ccoutant@google.com>2008-04-17 00:14:36 +0000
commitf3c69fcab18257246fa945f4a85388b54a34e512 (patch)
tree1ace720949b4dac7cdfa149283f578069babf9df /gold/symtab.h
parented83b9532695798e07c6f615d32e9c12109ff04e (diff)
downloadgdb-f3c69fcab18257246fa945f4a85388b54a34e512.zip
gdb-f3c69fcab18257246fa945f4a85388b54a34e512.tar.gz
gdb-f3c69fcab18257246fa945f4a85388b54a34e512.tar.bz2
* symtab.h (Symbol::is_strong_undefined): Removed unused function.
(Symbol::needs_plt_entry): Allow weak undefined symbols. (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when building shared libraries. * testsuite/Makefile.am (weak_undef_nonpic_test): New target. (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o) (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets. * testsuite/Makefile.in: Rebuild. * testsuite/weak_undef.h: New file. * testsuite/weak_undef_file1.cc: Add extra test cases. * testsuite/weak_undef_file2.cc: Likewise. * testsuite/weak_undef_test.cc: Likewise.
Diffstat (limited to 'gold/symtab.h')
-rw-r--r--gold/symtab.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/gold/symtab.h b/gold/symtab.h
index fb5828b..64e7a38 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -414,15 +414,6 @@ class Symbol
&& this->shndx() == elfcpp::SHN_UNDEF);
}
- // Return whether this is a strong (i.e., not weak) undefined symbol.
- bool
- is_strong_undefined() const
- {
- return (this->source_ == FROM_OBJECT
- && this->binding() != elfcpp::STB_WEAK
- && this->shndx() == elfcpp::SHN_UNDEF);
- }
-
// Return whether this is an absolute symbol.
bool
is_absolute() const
@@ -478,7 +469,7 @@ class Symbol
return (!parameters->doing_static_link()
&& this->type() == elfcpp::STT_FUNC
&& (this->is_from_dynobj()
- || this->is_strong_undefined()
+ || this->is_undefined()
|| this->is_preemptible()));
}
@@ -506,9 +497,14 @@ class Symbol
if (parameters->doing_static_link())
return false;
- // A reference to a weak undefined symbol or to an absolute symbol
- // does not need a dynamic relocation.
- if (this->is_weak_undefined() || this->is_absolute())
+ // A reference to a weak undefined symbol from an executable should be
+ // statically resolved to 0, and does not need a dynamic relocation.
+ // This matches gnu ld behavior.
+ if (this->is_weak_undefined() && !parameters->options().shared())
+ return false;
+
+ // A reference to an absolute symbol does not need a dynamic relocation.
+ if (this->is_absolute())
return false;
// An absolute reference within a position-independent output file