<div dir="ltr"><div><div><div>Hi there,<br><br></div>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.<br><br>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.<br><br></div>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.<br><br></div><div>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.<br><br></div><div>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.</div><div><br></div><div> Does that makes sense? Any thoughts, advices?<br clear="all"></div><div><div><div><div><div><div><div><div><div class="gmail_signature">--<br>Beren Minor</div></div>
</div></div></div></div></div></div></div></div>