This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Introduce Clang Linker Wrapper Tool
ClosedPublic

Authored by jhuber6 on Jan 3 2022, 10:00 AM.

Details

Summary

This patch introduces a linker wrapper tool that allows us to preprocess
files before they are sent to the linker. This adds a dummy action and
job to the driver stage that builds the linker command as usual and then
replaces the command line with the wrapper tool.

Depends on D116543

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 3 2022, 10:00 AM
jhuber6 requested review of this revision.Jan 3 2022, 10:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2022, 10:00 AM
JonChesterfield accepted this revision.Jan 31 2022, 7:12 AM

I think this is reasonable. It's a lot of boilerplate to put the interception shim in the right place, but we do want a specific point to inject offloading functionality and this is guarded by OPT_fopenmp_new_driver so should be safe. It'll be easy to adjust later if the patches that build on it end up needing different behaviour.

This revision is now accepted and ready to land.Jan 31 2022, 7:12 AM

Can you please add this tool's doc in clang/docs?

jhuber6 updated this revision to Diff 404585.Jan 31 2022, 9:58 AM

Adding documentation for tool.

This revision was landed with ongoing or failed builds.Jan 31 2022, 12:56 PM
This revision was automatically updated to reflect the committed changes.

"clang-linker-wrapper" seems like a very generic name for a command which is OpenMP offloading specific?

"clang-linker-wrapper" seems like a very generic name for a command which is OpenMP offloading specific?

This could potentially be used to handle CUDA / HIP offloading as well, so I deliberately chose not bind it too tightly to OpenMP offloading. I can change the name if people think that it's too confusing.