[cfe-dev] [clang] Implementing autolink with LLVM bitcode objects

Beren Minor via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 12 09:51:22 PST 2016


Wouldn't it be possible to create a custom section in the ELF object for
the linker flags, and have Clang parse them when it is used as a linker
invocation then pass them down to the linker? Obvisouly this won't work
when invoking the linker alone, but it could be a first step.

I believe Swift compiler does this kind of thing:
https://github.com/apple/swift/blob/master/tools/driver/autolink_extract_main.cpp
--
Beren Minor

On Tue, Jan 12, 2016 at 6:44 PM, Reid Kleckner <rnk at google.com> wrote:

> On Thu, Jan 7, 2016 at 8:07 AM, David Blaikie via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Sounds plausible - as for which direction to go, I don't know (it's
>> hardly my area of expertise) though the bitcode/module-agnostic version
>> does seem preferable. Is there any prior art in the area? One or more
>> linkers that already support the sort of feature you've described (so the
>> linker looks for the special object file section with the info, rather than
>> the compile driver?)
>>
>
> We already implement autolinking on Mac and Windows, but not Linux. So far
> as I know there is no way for an ELF object file to tell the linker to pull
> in more libraries, but MachO and COFF can do this.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160112/842e4437/attachment.html>


More information about the cfe-dev mailing list