[PATCH] D145899: [AIX][Clang] Respect -r when invoking the linkerOn AIX, libraries are still being linked when `-r` is passed to the driver. This patch corrects this error.
Michael Francis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 12 23:55:32 PDT 2023
francii created this revision.
Herald added a project: All.
francii requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145899
Files:
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1692,6 +1692,8 @@
break;
}
case ToolChain::UNW_CompilerRT:
+ if (Args.hasArg(options::OPT_r))
+ break;
if (TC.getTriple().isOSAIX()) {
// AIX only has libunwind as a shared library. So do not pass
// anything in if -static is specified.
Index: clang/lib/Driver/ToolChains/AIX.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -175,7 +175,7 @@
};
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
- options::OPT_shared)) {
+ options::OPT_shared, options::OPT_r)) {
CmdArgs.push_back(
Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename())));
@@ -233,6 +233,13 @@
}
// Add directory to library search path.
+ if (Args.hasArg(options::OPT_r)) {
+ const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
+ C.addCommand(std::make_unique<Command>(
+ JA, *this, ResponseFileSupport::None(), Exec, CmdArgs, Inputs, Output));
+ return;
+ }
+
Args.AddAllArgs(CmdArgs, options::OPT_L);
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
ToolChain.addProfileRTLibs(Args, CmdArgs);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145899.504514.patch
Type: text/x-patch
Size: 1449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230313/b772da9b/attachment.bin>
More information about the cfe-commits
mailing list