diff options
author | Cary Coutant <ccoutant@google.com> | 2010-07-09 01:34:31 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2010-07-09 01:34:31 +0000 |
commit | ce279a62c420e20c2d33e89641b6d9ed581a90c2 (patch) | |
tree | 10299dc3eb7f6c0fddb969fa11ae0dc079165aa0 /gold/symtab.h | |
parent | 2ee2fea80422d6e481541aa20a5d4e26ca8f0192 (diff) | |
download | gdb-ce279a62c420e20c2d33e89641b6d9ed581a90c2.zip gdb-ce279a62c420e20c2d33e89641b6d9ed581a90c2.tar.gz gdb-ce279a62c420e20c2d33e89641b6d9ed581a90c2.tar.bz2 |
* resolve.cc (Symbol_table::resolve): Remember whether undef was
weak when resolving to a dynamic def.
(Symbol_table::should_override): Add adjust_dyndef flag; set it
for weak undef/dynamic def cases. Adjust callers.
* symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
undef_binding_weak_.
(Symbol_table::sized_write_globals): Adjust symbol binding.
(Symbol_table::sized_write_symbol): Add binding parameter.
* symtab.h (Symbol::set_undef_binding): New method.
(Symbol::is_undef_binding_weak): New method.
(Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
(Symbol_table::should_override): Add new parameter.
(Symbol_table::sized_write_symbol): Add new parameter.
* testsuite/weak_undef_file1.cc: Add new test case.
* testsuite/weak_undef_file2.cc: Fix header comment.
* testsuite/weak_undef_test.cc: Add new test case.
Diffstat (limited to 'gold/symtab.h')
-rw-r--r-- | gold/symtab.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gold/symtab.h b/gold/symtab.h index 7d75e06..3058546 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -227,6 +227,23 @@ class Symbol void override_visibility(elfcpp::STV); + // Set whether the symbol was originally a weak undef or a regular undef + // when resolved by a dynamic def. + inline void + set_undef_binding(elfcpp::STB bind) + { + if (!this->undef_binding_set_ || this->undef_binding_weak_) + { + this->undef_binding_weak_ = bind == elfcpp::STB_WEAK; + this->undef_binding_set_ = true; + } + } + + // Return TRUE if a weak undef was resolved by a dynamic def. + inline bool + is_undef_binding_weak() const + { return this->undef_binding_weak_; } + // Return the non-visibility part of the st_other field. unsigned char nonvis() const @@ -949,6 +966,11 @@ class Symbol // True if this symbol is defined in a section which was discarded // (bit 31). bool is_defined_in_discarded_section_ : 1; + // True if UNDEF_BINDING_WEAK_ has been set (bit 32). + bool undef_binding_set_ : 1; + // True if this symbol was a weak undef resolved by a dynamic def + // (bit 33). + bool undef_binding_weak_ : 1; }; // The parts of a symbol which are size specific. Using a template @@ -1536,7 +1558,7 @@ class Symbol_table // Whether we should override a symbol, based on flags in // resolve.cc. static bool - should_override(const Symbol*, unsigned int, Defined, Object*, bool*); + should_override(const Symbol*, unsigned int, Defined, Object*, bool*, bool*); // Report a problem in symbol resolution. static void @@ -1667,7 +1689,7 @@ class Symbol_table void sized_write_symbol(Sized_symbol<size>*, typename elfcpp::Elf_types<size>::Elf_Addr value, - unsigned int shndx, + unsigned int shndx, elfcpp::STB, const Stringpool*, unsigned char* p) const; // Possibly warn about an undefined symbol from a dynamic object. |