From f1f70eae2856e8a0aae42d74829cedcb02b9801b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 6 May 2008 17:46:31 +0000 Subject: * options.h (class General_options): Add -Bsymbolic-functions. * symtab.h (Symbol::is_preemptible): Check for -Bsymbolic-functions. --- gold/symtab.h | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'gold/symtab.h') diff --git a/gold/symtab.h b/gold/symtab.h index 1ee3131..020f242 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -467,12 +467,36 @@ class Symbol // is preemptible. gold_assert(!this->is_undefined()); - return (this->visibility_ != elfcpp::STV_INTERNAL - && this->visibility_ != elfcpp::STV_HIDDEN - && this->visibility_ != elfcpp::STV_PROTECTED - && !this->is_forced_local_ - && parameters->options().shared() - && !parameters->options().Bsymbolic()); + // If a symbol does not have default visibility, it can not be + // seen outside this link unit and therefore is not preemptible. + if (this->visibility_ != elfcpp::STV_DEFAULT) + return false; + + // If this symbol has been forced to be a local symbol by a + // version script, then it is not visible outside this link unit + // and is not preemptible. + if (this->is_forced_local_) + return false; + + // If we are not producing a shared library, then nothing is + // preemptible. + if (!parameters->options().shared()) + return false; + + // If the user used -Bsymbolic, then nothing is preemptible. + if (parameters->options().Bsymbolic()) + return false; + + // If the user used -Bsymbolic-functions, then functions are not + // preemptible. We explicitly check for not being STT_OBJECT, + // rather than for being STT_FUNC, because that is what the GNU + // linker does. + if (this->type() != elfcpp::STT_OBJECT + && parameters->options().Bsymbolic_functions()) + return false; + + // Otherwise the symbol is preemptible. + return true; } // Return true if this symbol is a function that needs a PLT entry. -- cgit v1.1