[llvm-dev] LLD doesn't handle globals with appending linkage
Gleb Popov via llvm-dev
llvm-dev at lists.llvm.org
Tue Feb 18 00:28:44 PST 2020
Hello.
I'm posting this question here, because there seem to be no LLD-specific
mailing list. Sorry in advance if this is wrong one.
I compile two C source with following command:
clang -flto -o %name.bc %name.c
LLVM is augmented with my custom pass, which amongst other things create a
global with appending linkage:
@myvar = appending constant [1 x [1 x i8]*] ...
I also have another pass plugged into LTO pipeline, which turns this global
into internal one in the final module. I was hoping that LLD would first
link bitcodes like llvm-link, appending @myvar's from both modules into a
single one, then run my pass, and only then perform linking at object level.
However, LLD complains about duplicated symbol "myvar" and doesn't even run
any passes.
I've tracked the problem down to BitcodeFile::parse() function from
https://github.com/llvm/llvm-project/blob/master/lld/COFF/InputFiles.cpp#L918
- it doesn't take linkage type into account.
Can anything be done about this problem? Or was my approach broken from the
beginning?
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200218/b74c152b/attachment.html>
More information about the llvm-dev
mailing list