Author: Fangrui Song Date: 2020-05-16T23:54:31-07:00 New Revision: 3841ed4104ac32eae7305d07e4558ea607fa69f3
URL: https://github.com/llvm/llvm-project/commit/3841ed4104ac32eae7305d07e4558ea607fa69f3 DIFF: https://github.com/llvm/llvm-project/commit/3841ed4104ac32eae7305d07e4558ea607fa69f3.diff LOG: [Driver] Render -T for Gnu.cpp clang -T a.lds a.c currently does not render -T. Added: Modified: clang/lib/Driver/ToolChains/Gnu.cpp clang/test/Driver/Xlinker-args.c Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 315988faf40a..9a340142a242 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -630,6 +630,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, AddHIPLinkerScript(getToolChain(), C, Output, Inputs, Args, CmdArgs, JA, *this); + Args.AddAllArgs(CmdArgs, options::OPT_T); + const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); C.addCommand(std::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs)); } diff --git a/clang/test/Driver/Xlinker-args.c b/clang/test/Driver/Xlinker-args.c index a828f15b2b9a..72c2fd2698e8 100644 --- a/clang/test/Driver/Xlinker-args.c +++ b/clang/test/Driver/Xlinker-args.c @@ -5,15 +5,16 @@ // RUN: -Xlinker one -Xlinker --no-demangle \ // RUN: -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t // RUN: FileCheck -check-prefix=DARWIN < %t %s -// + +/// -T is reordered to the last to make sure -L takes precedence. // RUN: %clang -target x86_64-pc-linux-gnu -### \ -// RUN: -Xlinker one -Xlinker --no-demangle \ +// RUN: -T a.lds -Xlinker one -Xlinker --no-demangle \ // RUN: -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t // RUN: FileCheck -check-prefix=LINUX < %t %s // // DARWIN-NOT: --no-demangle // DARWIN: "one" "two" "three" "four" "-z" "five" "-r" -// LINUX: "--no-demangle" "one" "two" "three" "four" "-z" "five" "-r" +// LINUX: "--no-demangle" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds" // Check that we forward '-Xlinker' and '-Wl,' on Windows. // RUN: %clang -target i686-pc-win32 -### \ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits