xref: /llvm-project/clang/test/Driver/Xlinker-args.c (revision 39ac8b25cdca230509078d575d46c538bdf90e18)
1 // Check that we extract --no-demangle from '-Xlinker' and '-Wl,', since that
2 // was a collect2 argument.
3 
4 // RUN: %clang -target i386-apple-darwin9 -### \
5 // RUN:   -Xlinker one -Xlinker --no-demangle \
6 // RUN:   -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t
7 // RUN: FileCheck -check-prefix=DARWIN < %t %s
8 
9 /// -T is reordered to the last to make sure -L takes precedence.
10 // RUN: %clang -target x86_64-pc-linux-gnu -### \
11 // RUN:   -e _start -T a.lds -t -Xlinker one -Xlinker --no-demangle \
12 // RUN:   -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t
13 // RUN: FileCheck -check-prefix=LINUX < %t %s
14 
15 /// Check that --no-demangle gets forwarded to the mingw linker
16 // RUN: %clang -target x86_64-w64-mingw32 -### \
17 // RUN:   -Wl,--no-demangle %s 2> %t
18 // RUN: FileCheck -check-prefix=MINGW < %t %s
19 
20 // RUN: %clang -target powerpc-unknown-aix -### \
21 // RUN:   -b one -b two %s 2> %t
22 // RUN: FileCheck -check-prefix=AIX < %t %s
23 
24 // DARWIN-NOT: --no-demangle
25 // DARWIN: "one" "two" "three" "four" "-z" "five" "-r"
26 // LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds" "-t"
27 // MINGW: "--no-demangle"
28 // AIX: "-b" "one" "-b" "two"
29 
30 // Check that we forward '-Xlinker' and '-Wl,' on Windows.
31 // RUN: %clang -target i686-pc-win32 -fuse-ld=link -### \
32 // RUN:   -Xlinker one -Wl,two %s 2>&1 | \
33 // RUN:   FileCheck -check-prefix=WIN %s
34 // WIN: link.exe
35 // WIN: "one"
36 // WIN: "two"
37