[PATCH] D107786: [AIX]: Fix option processing for -b
Ettore Tiotto via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 9 16:25:45 PDT 2021
etiotto updated this revision to Diff 365312.
etiotto added a comment.
Address code review comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107786/new/
https://reviews.llvm.org/D107786
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/Xlinker-args.c
Index: clang/test/Driver/Xlinker-args.c
===================================================================
--- clang/test/Driver/Xlinker-args.c
+++ clang/test/Driver/Xlinker-args.c
@@ -13,7 +13,7 @@
// RUN: FileCheck -check-prefix=LINUX < %t %s
// RUN: %clang -target powerpc-unknown-aix -### \
-// RUN: -b one %s 2> %t
+// RUN: -b one -b two %s 2> %t
// RUN: FileCheck -check-prefix=AIX < %t %s
// RUN: %clang -target powerpc-unknown-linux -### \
@@ -23,7 +23,7 @@
// DARWIN-NOT: --no-demangle
// DARWIN: "one" "two" "three" "four" "-z" "five" "-r"
// LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds"
-// AIX: "-b" "one"
+// AIX: "-b" "one" "-b" "two"
// NOT-AIX: error: unsupported option '-b' for target 'powerpc-unknown-linux'
// Check that we forward '-Xlinker' and '-Wl,' on Windows.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -257,16 +257,6 @@
// Otherwise, this is a linker input argument.
const Arg &A = II.getInputArg();
- if (A.getOption().matches(options::OPT_b)) {
- const llvm::Triple &T = TC.getTriple();
- if (!T.isOSAIX()) {
- TC.getDriver().Diag(diag::err_drv_unsupported_opt_for_target)
- << A.getSpelling() << T.str();
- }
- // Pass -b prefix for AIX linker.
- A.claim();
- A.render(Args, CmdArgs);
- }
// Handle reserved library options.
if (A.getOption().matches(options::OPT_Z_reserved_lib_stdcxx))
TC.AddCXXStdlibLibArgs(Args, CmdArgs);
@@ -276,6 +266,15 @@
// Pass -z prefix for gcc linker compatibility.
A.claim();
A.render(Args, CmdArgs);
+ } else if (A.getOption().matches(options::OPT_b)) {
+ const llvm::Triple &T = TC.getTriple();
+ if (!T.isOSAIX()) {
+ TC.getDriver().Diag(diag::err_drv_unsupported_opt_for_target)
+ << A.getSpelling() << T.str();
+ }
+ // Pass -b prefix for AIX linker.
+ A.claim();
+ A.render(Args, CmdArgs);
} else {
A.renderAsInput(Args, CmdArgs);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107786.365312.patch
Type: text/x-patch
Size: 2219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210809/2f371f0e/attachment-0001.bin>
More information about the cfe-commits
mailing list