[cfe-dev] Replace a call to llvm-link with some API calls

Jon Chesterfield via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 27 10:51:34 PDT 2021


Hello front end devs,

AMDGPUOpenMP.cpp in Driver/ToolChains currently spawns an instance of
llvm-link to stitch multiple input files together and splice in ~libm at
the same time.

I can solve an obscure amdgpu-specific problem if that fork to llvm-link
can be replaced by calling into the corresponding llvm libs. Specifically I
need the attribute propagation behaviour of mlink-builtin-bitcode. Similar
motivation as D28538 for nvptx.

It seems like calling llvm-link from the driver (from
constructLLVMLinkCommand) is an unusual thing to do. What I basically want
to do is call CodeGenModule::addDefaultFunctionDefinitionAttributes on each
function in each file that is being linked. The producer of that file is
unlikely to put the proper attributes on it.

What's the clean / sensible way to achieve this? Passing libm to lld
instead is attractive, but lld also won't append the default function
attributes. Patching llvm-link to optionally do this munging on the fly
seems dubious.

Thank you!

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211027/35f89ebc/attachment.html>


More information about the cfe-dev mailing list