[PATCH] D105091: [RISCV] Pass -u to linker correctly.

Kito Cheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 8 00:33:25 PDT 2021


kito-cheng updated this revision to Diff 357152.
kito-cheng added a comment.

Update testcase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105091/new/

https://reviews.llvm.org/D105091

Files:
  clang/lib/Driver/ToolChains/RISCVToolchain.cpp
  clang/test/Driver/riscv-args.c


Index: clang/test/Driver/riscv-args.c
===================================================================
--- clang/test/Driver/riscv-args.c
+++ clang/test/Driver/riscv-args.c
@@ -1,7 +1,11 @@
 // Check the arguments are correctly passed
 
 // Make sure -T is the last with gcc-toolchain option
-// RUN: %clang -### -target riscv32 \
-// RUN:   --gcc-toolchain= -Xlinker --defsym=FOO=10 -T a.lds %s 2>&1 \
+// RUN: %clang -### -target riscv32 --gcc-toolchain= -Xlinker --defsym=FOO=10 -T a.lds %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-LD %s
 // CHECK-LD: {{.*}} "--defsym=FOO=10" {{.*}} "-T" "a.lds"
+
+// Make sure -u has passed to linker
+// RUN: %clang -### -target riscv32 --gcc-toolchain= -u foo %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-U-LD %s
+// CHECK-U-LD: {{.*}} "-u" "foo"
Index: clang/lib/Driver/ToolChains/RISCVToolchain.cpp
===================================================================
--- clang/lib/Driver/ToolChains/RISCVToolchain.cpp
+++ clang/lib/Driver/ToolChains/RISCVToolchain.cpp
@@ -184,6 +184,7 @@
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
+  Args.AddAllArgs(CmdArgs, options::OPT_u);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
   Args.AddAllArgs(CmdArgs,
                   {options::OPT_T_Group, options::OPT_e, options::OPT_s,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105091.357152.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210708/16cf43a6/attachment.bin>


More information about the cfe-commits mailing list