diff options
author | Ian Lance Taylor <iant@google.com> | 2008-02-08 22:49:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2008-02-08 22:49:22 +0000 |
commit | 8fc19601e8cc9e67bbc39c41fd368df15dcc20aa (patch) | |
tree | 508721bdc307d3a9917507013f648fb79e4fcd0f /gold/symtab.h | |
parent | 8da2a1df1661ca37851fd21c1dda16d433a5811a (diff) | |
download | gdb-8fc19601e8cc9e67bbc39c41fd368df15dcc20aa.zip gdb-8fc19601e8cc9e67bbc39c41fd368df15dcc20aa.tar.gz gdb-8fc19601e8cc9e67bbc39c41fd368df15dcc20aa.tar.bz2 |
From Cary Coutant: fix handling of undefined symbols in shared
libraries.
Diffstat (limited to 'gold/symtab.h')
-rw-r--r-- | gold/symtab.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gold/symtab.h b/gold/symtab.h index b60256e..4d25840 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -462,6 +462,10 @@ class Symbol // another object is preemptible. gold_assert(!this->is_from_dynobj()); + // It doesn't make sense to ask whether an undefined symbol + // is preemptible. + gold_assert(!this->is_undefined()); + return (this->visibility_ != elfcpp::STV_INTERNAL && this->visibility_ != elfcpp::STV_HIDDEN && this->visibility_ != elfcpp::STV_PROTECTED @@ -472,12 +476,16 @@ class Symbol // Return true if this symbol is a function that needs a PLT entry. // If the symbol is defined in a dynamic object or if it is subject - // to pre-emption, we need to make a PLT entry. + // to pre-emption, we need to make a PLT entry. If we're doing a + // static link, we don't create PLT entries. bool needs_plt_entry() const { - return (this->type() == elfcpp::STT_FUNC - && (this->is_from_dynobj() || this->is_preemptible())); + return (!parameters->doing_static_link() + && this->type() == elfcpp::STT_FUNC + && (this->is_from_dynobj() + || this->is_undefined() + || this->is_preemptible())); } // When determining whether a reference to a symbol needs a dynamic @@ -500,6 +508,10 @@ class Symbol bool needs_dynamic_reloc(int flags) const { + // No dynamic relocations in a static link! + if (parameters->doing_static_link()) + return false; + // An absolute reference within a position-independent output file // will need a dynamic relocation. if ((flags & ABSOLUTE_REF) @@ -522,7 +534,9 @@ class Symbol // A reference to a symbol defined in a dynamic object or to a // symbol that is preemptible will need a dynamic relocation. - if (this->is_from_dynobj() || this->is_preemptible()) + if (this->is_from_dynobj() + || this->is_undefined() + || this->is_preemptible()) return true; // For all other cases, return FALSE. @@ -545,7 +559,9 @@ class Symbol // A reference to a symbol defined in a dynamic object or to a // symbol that is preemptible can not use a RELATIVE relocaiton. - if (this->is_from_dynobj() || this->is_preemptible()) + if (this->is_from_dynobj() + || this->is_undefined() + || this->is_preemptible()) return false; // For all other cases, return TRUE. |