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

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 7 08:07:59 PST 2016


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?)

On Tue, Dec 22, 2015 at 11:23 AM, Beren Minor via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi there,
>
> I am playing around with clang C++ Modules, trying to figure ou how it
> could be leveraged to get rid of build systems on simple projects.
>
> I want to use the link attribute in the modulemap to indicate which
> library should be linked when a module is imported, however AFAIK the
> capability to automatically add these flags to the link flags depends on
> the underlying linker and the GNU linker doesn't support it.
>
> At the moment I use LLVM bitcode as my object file format, because Clang
> keeps the module link flags in a "Linker Options" attribute, and I can
> parse the object files afterwards to extract these flags and add them to my
> link command-line. Clang does then the lowering to native objects and the
> actual native linker call.
>
> I would like to simplify this, and I was thinking that Clang could parse
> the object files itself if they are LLVM BC, and then pass the flags to the
> linker if the link step is done in the same execution.
>
> I have two way of doing it in mind, first way would be to have the driver
> parse the objects and add the required flags to the link action, but maybe
> it's not the right place to do that. Another way would be to add the linker
> flags in some private ELF section during the compilation phase, and have
> the link phase load them afterwards, which could work even without LLVM
> bitcode intermediate.
>
> Does that makes sense? Any thoughts, advices?
> --
> Beren Minor
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160107/187004c7/attachment.html>


More information about the cfe-dev mailing list