(original) (raw)
On Wed, Oct 5, 2016 at 5:44 PM, Mehdi Amini <mehdi.amini@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