Fix incorrect handling of STT_COMMON symbols in shared libraries.
authorCary Coutant <ccoutant@gmail.com>
Sun, 7 Jun 2015 21:03:09 +0000 (14:03 -0700)
committerCary Coutant <ccoutant@gmail.com>
Sun, 7 Jun 2015 21:03:52 +0000 (14:03 -0700)
commitb8cf50755b573140aae71f7247b604373fcdfbeb
tree9703225459949bc9fde830bbf7bba2cca5dcd38d
parent66f38e2951a1f7110ca3f1adf362322ec4208428
Fix incorrect handling of STT_COMMON symbols in shared libraries.

The gABI allows STT_COMMON symbols to appear in executables and shared
objects, so that the dynamic loader can resolve commons across modules.
When reading a shared object, however, an STT_COMMON symbol should be
treated as a regular definition at link time.

In a relocatable object, the gABI requires that any STT_COMMON symbols
must also be defined in the special SHN_COMMON section (which we extend
to include target-specific small and large common sections). Thus,
there is no need for gold to treat STT_COMMON symbols as common unless
the st_shndx field is also set to a common section.

gold/
PR gold/18288
* resolve.cc (symbol_to_bits): Remove type parameter; adjust all
callers. Don't use STT_COMMON to check for common symbols.
(Symbol_table::resolve): Warn if relocatable object has STT_COMMON
symbol that's not in a common section.
* symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
common symbols.
gold/ChangeLog
gold/resolve.cc
gold/symtab.h