[clang] 39ac8b2 - [clang][GNU] Pass -t through to the linker (#112106)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 09:24:45 PDT 2024


Author: Keith Smiley
Date: 2024-10-14T09:24:42-07:00
New Revision: 39ac8b25cdca230509078d575d46c538bdf90e18

URL: https://github.com/llvm/llvm-project/commit/39ac8b25cdca230509078d575d46c538bdf90e18
DIFF: https://github.com/llvm/llvm-project/commit/39ac8b25cdca230509078d575d46c538bdf90e18.diff

LOG: [clang][GNU] Pass -t through to the linker (#112106)

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 1eacb252838c69..8397f1121ec2ce 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -671,7 +671,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     }
   }
 
-  Args.AddAllArgs(CmdArgs, options::OPT_T);
+  Args.addAllArgs(CmdArgs, {options::OPT_T, options::OPT_t});
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique<Command>(JA, *this,

diff  --git a/clang/test/Driver/Xlinker-args.c b/clang/test/Driver/Xlinker-args.c
index b2a913e7cef620..87f98a0cdbd837 100644
--- a/clang/test/Driver/Xlinker-args.c
+++ b/clang/test/Driver/Xlinker-args.c
@@ -8,7 +8,7 @@
 
 /// -T is reordered to the last to make sure -L takes precedence.
 // RUN: %clang -target x86_64-pc-linux-gnu -### \
-// RUN:   -e _start -T a.lds -Xlinker one -Xlinker --no-demangle \
+// RUN:   -e _start -T a.lds -t -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
 
@@ -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"
+// LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds" "-t"
 // MINGW: "--no-demangle"
 // AIX: "-b" "one" "-b" "two"
 


        


More information about the cfe-commits mailing list