Files
clang-p2996/lld/lib/ReaderWriter/ELF
Simon Atanasyan 07000878f8 [ELF] Export strong defined symbol if it coalesces away a weak symbol
defined in a shared library.

Now LLD does not export a strong defined symbol if it coalesces away a
weak symbol defined in a shared library. This bug affects all ELF
architectures and leads to segfault:

  % cat foo.c
  extern int __attribute__((weak)) flag;
  int foo() { return flag; }

  % cat main.c
  int flag = 1;
  int foo();
  int main() { return foo() == 1 ? 0 : -1; }

  % clang -c -fPIC foo.c main.c
  % lld -flavor gnu -target x86_64 -shared -o libfoo.so ... foo.o
  % lld -flavor gnu -target x86_64 -o a.out ... main.o libfoo.so
  % ./a.out
  Segmentation fault

The problem is caused by the fact that we lose all information about
coalesced symbols after the `Resolver::resolve()` method is finished.

The patch solves the problem by overriding the
`LinkingContext::notifySymbolTableCoalesce()` method and saving names
of coalesced symbols. Later in the `buildDynamicSymbolTable()` routine
we use this information to export these symbols.

llvm-svn: 217363
2014-09-08 09:43:38 +00:00
..
2014-07-05 11:39:02 +00:00
2014-07-21 13:16:53 +00:00
2014-06-12 21:35:33 +00:00
2014-06-12 21:35:33 +00:00
2014-08-13 13:16:38 +00:00
2014-04-03 21:06:23 +00:00
2014-01-27 03:09:26 +00:00
2014-09-08 04:05:52 +00:00
2014-07-05 11:39:02 +00:00
2014-07-05 11:39:02 +00:00
2014-08-13 13:16:38 +00:00
2014-03-28 05:17:59 +00:00