[llvm-dev] ThinLTO: passing TargetOptions to LLVMgold.so

Johan Engelen via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 6 02:01:47 PDT 2016


On Wed, Oct 5, 2016 at 5:44 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>
>
> > But some other options are not expressed in IR (e.g. FunctionSections,
> relocation model).
> > I see that I can pass LLVM options to the plugin, so one way is to pass
> all non-default options as plugin-opt cmdline flags. I can't find code in
> Clang that does that though.
>
> The usual model is that the linker interacts with the LTO codegen to pass
> these options.
>

My question is: how does the linker know what to tell the LTO codegen? ;)



> Assuming you’d link a program on MacOS with ThinLTO for instance, the
> linker will derive the “pic model” the following way:
> https://github.com/Apple-FOSS-Mirror/ld64/blob/master/src/
> ld/parsers/lto_file.cpp#L594 (not the call to
> ::lto_codegen_set_pic_model).
>

Thanks a lot for the pointer. (didn't even realize that `ld64` source is so
easily available) This lead me to where `ld64` receives the options, so I
can browse through that to see what it accepts (it accepts `-mllvm` so
that's nice).

-Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161006/4de1d3e6/attachment.html>


More information about the llvm-dev mailing list