Export __progname even if a -dynamic-list is given.
authorRui Ueyama <ruiu@google.com>
Tue, 25 Apr 2017 00:15:48 +0000 (00:15 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 25 Apr 2017 00:15:48 +0000 (00:15 +0000)
commit321b9cd072c1738476e7269e624a6f807a9117f2
treec719003871bc77fea92e857269c85745b7ca2350
parentbbebcb6c4d18b80a5bb0d0a3187624d61ebaa305
Export __progname even if a -dynamic-list is given.

BSD's __progname symbol is defined in crt1.o and linked against main
executables. The libc expects that main executables export __progname
symbol via .dynsym sections. In order to handle this case, we scan
undefined symbols in DSOs and exported them by setting Sym->ExportDynamic
to true.

But it turned out that setting that variable is not enough to make sure
that symbols are exported in all use cases. If a -dynamic-list option is
given, all symbols not explicitly mentioned in a version script are
hidden by default. That hides __progname symbol. This patch fixes the issue.

Fixes https://bugs.llvm.org/show_bug.cgi?id=32703

llvm-svn: 301282
lld/ELF/SymbolTable.cpp
lld/test/ELF/progname.s