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

Robinson, Paul via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 12 15:03:33 PST 2016


(remembering to cc: cfe-dev this time)

On PS4 we put those kinds of smarts into the linker. We invented a custom ELF section for passing things like extra library names (a-la pragma comment lib) plus the linker will auto-detect BC files and run them through LTO.
I've also seen a platform (not sure which) that invented really elaborate mechanisms that they then stuck into the .comment section.
--paulr


From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Beren Minor via cfe-dev
Sent: Tuesday, January 12, 2016 9:51 AM
To: Reid Kleckner
Cc: Clang Dev
Subject: Re: [cfe-dev] [clang] Implementing autolink with LLVM bitcode objects

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<mailto: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<mailto: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/5a6787fa/attachment.html>


More information about the cfe-dev mailing list