[llvm-dev] llvm-link has no --allow-multiple-definition

Eli Friedman via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 9 12:24:06 PDT 2020

Despite the name, llvm-link isn't really a proper linker.  If you need symbols to get resolved exactly the same way an ELF linker would resolve them, I would recommend using lld.

It's possible to write a pass plugin that hooks into the LTO pipeline.  http://llvm.org/docs/WritingAnLLVMPass.html describes this.


> -----Original Message-----
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Marc via llvm-
> dev
> Sent: Sunday, March 8, 2020 10:01 AM
> To: llvm-dev <llvm-dev at lists.llvm.org>
> Subject: [EXT] [llvm-dev] llvm-link has no --allow-multiple-definition
> Hello,
> I am developing an LTO instrumentation of programs for fuzzing (for
> afl++) and I run into the following problem:
> a lot of open source program have multiple definitons of the same
> functions. In normal compile mode this is not a problem, however with
> LTO this only works with the linker option:
>  -Wl,--allow-multiple-definition
> Now to be able to instrument (it is an "opt" pass") at link time I need
> to merge all bitcode files together, and this works great - unless I run
> into this error when I link them to llvm-link:
> error: Linking globals named 'process_arg': symbol multiply defined!
> (this is for the bogofilter tools, but happens with other open source
> program too).
> My issue is that neither is --allow-multiple-definition an llvm-link
> command line option, nor can I find an equivalent from the --help output.
> is there a plan to add this (IMHO) important feature? Thank you!
> Regards,
> Marc
> --
> Marc Heuse
> www.mh-sec.de
> PGP: AF3D 1D4C D810 F0BB 977D  3807 C7EE D0A0 6BE9 F573
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list