aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-09-08 09:43:38 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-09-08 09:43:38 +0000
commit07000878f8d2385e197d24b621c83173f06ddf19 (patch)
tree8996e8b4cdb6ab4d76cbab3a29b33ac84ba414bd /clang/lib/CodeGen/CodeGenModule.cpp
parent256d5512e6ef05526d8d7bd46e9d58eeb24fddc0 (diff)
downloadllvm-07000878f8d2385e197d24b621c83173f06ddf19.zip
llvm-07000878f8d2385e197d24b621c83173f06ddf19.tar.gz
llvm-07000878f8d2385e197d24b621c83173f06ddf19.tar.bz2
[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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions