[llvm] r185882 - Don't run internalize if we're outputing bit-code and not an object file.
Rafael Espíndola
rafael.espindola at gmail.com
Fri Aug 9 08:04:44 PDT 2013
> The linker already does tell LTO to preserve all global symbols in -r mode.
>
> Given that the original bug involved linker private symbols (start with
> ‘l’), I made a test case of all combinations of weak, hidden, and linker
> private. I did notice that the merging of bit code files happens as if the
> -keep_private_externs were used, but that should not matter.
>
> Was does seem to be the problem is that the weak bit is lost on
> _weak_hidden_glob and l_weak_hidden_special.
Interesting. This seems to work on ELF:
$ cat test.c
__attribute__((weak, visibility("hidden")))
void weak_hidden_glob() { }
$ clang -c test.c -flto
$ ld --plugin /home/espindola/inst/clang/lib/LLVMgold.so -r test.o -o test-r.o
$ readelf -sW test-r.o
Symbol table '.symtab' contains 4 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 SECTION LOCAL DEFAULT 5
2: 0000000000000000 0 FILE LOCAL DEFAULT ABS ld-temp.o
3: 0000000000000000 6 FUNC WEAK HIDDEN 5 weak_hidden_glob
$ ld --plugin /home/espindola/inst/clang/lib/LLVMgold.so -r test.o
-plugin-opt emit-llvm -o test-r.o
$ llvm-dis test-r.o -o - | grep weak_hi
define weak hidden void @weak_hidden_glob() #0 {
Cheers,
Rafael
More information about the llvm-commits
mailing list