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 -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 // DARWIN-NOT: --no-demangle
16 // DARWIN: "one" "two" "three" "four" "-z" "five" "-r"
17 // LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds"
18 
19 // Check that we forward '-Xlinker' and '-Wl,' on Windows.
20 // RUN: %clang -target i686-pc-win32 -### \
21 // RUN:   -Xlinker one -Wl,two %s 2>&1 | \
22 // RUN:   FileCheck -check-prefix=WIN %s
23 // WIN: link.exe
24 // WIN: "one"
25 // WIN: "two"
26