This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Fix -mllvm option for device lld linker
ClosedPublic

Authored by yaxunl on Jun 29 2023, 1:11 PM.

Details

Summary

currently clang passes -mllvm options to the device lld linker plugin
when compiling HIP. This is against default clang behavior
which is only passing -mllvm options to linker plugin specified through -Wl
options. This patch lets clang only pass -Xoffload-linker -mllvm= options
to device lld linker plugin.

Fixes: https://github.com/llvm/llvm-project/issues/63604

Diff Detail

Event Timeline

yaxunl created this revision.Jun 29 2023, 1:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2023, 1:11 PM
yaxunl requested review of this revision.Jun 29 2023, 1:11 PM
jhuber6 accepted this revision.Jun 29 2023, 1:19 PM

LG, thanks.

This revision is now accepted and ready to land.Jun 29 2023, 1:19 PM
arsenm added a subscriber: arsenm.Jun 29 2023, 2:30 PM
arsenm added inline comments.
clang/lib/Driver/ToolChains/HIPAMD.cpp
164

StringRef Prefix("-mllvm=") and then use the length instead of strlen

jhuber6 added inline comments.Jun 29 2023, 2:31 PM
clang/lib/Driver/ToolChains/HIPAMD.cpp
164

You could probably also do ArgVal.split("-mllvm=").second and push back first or second depending on whether or not second is empty.

yaxunl marked 2 inline comments as done.Jun 30 2023, 9:52 AM
yaxunl added inline comments.
clang/lib/Driver/ToolChains/HIPAMD.cpp
164

will use ArgVal.split

This revision was landed with ongoing or failed builds.Jun 30 2023, 9:55 AM
This revision was automatically updated to reflect the committed changes.
yaxunl marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2023, 9:55 AM