================
@@ -61,3 +61,22 @@
! CHECK-TWO-CONFIGS-NEXT: Configuration file:
{{.*}}Inputs{{.}}config2{{.}}config-4.cfg
! CHECK-TWO-CONFIGS: -ffp-contract=fast
! CHECK-TWO-CONFIGS: -O3
+
+!--- The -l flags should be moved to the end of input list and appear only
when linking.
+! RUN: %flang --config %S/Inputs/config-l.cfg -o %s.out %s -### 2>&1 |
FileCheck %s -check-prefix CHECK-LINKING
+! RUN: %flang --config %S/Inputs/config-l-openmp.cfg -o %s.out %s -### 2>&1 |
FileCheck %s -check-prefix CHECK-LINKING-LIBOMP-GOES-LAST
+! RUN: %flang --config %S/Inputs/config-l.cfg -S %s -### 2>&1 | FileCheck %s
-check-prefix CHECK-NOLINKING
+! RUN: %flang --config %S/Inputs/config-l-openmp.cfg -S %s -### 2>&1 |
FileCheck %s -check-prefix CHECK-NOLINKING
+! CHECK-LINKING: Configuration file: {{.*}}Inputs{{.}}config-l.cfg
+! CHECK-LINKING: "-ffast-math"
+! CHECK-LINKING: "/tmp/{{.*}}-{{.*}}.o" "-lm" "-lhappy"
----------------
DavidTruby wrote:
`/tmp` doesn't exist on Windows. If you really need to check the full path,
you'll have to do something like adding
`! RUN: mkdir %t`
before the first RUN line, and
` ! RUN: env TMPDIR=%t TEMP=%t TMP=%t %flang ...`
on every run line, although I couldn't quite make this work correctly when I
quickly looked.
Alternatively, just don't check the directory, I don't see any other tests in
clang that check the directory that the temporary object is in.
Additionally, the driver will translate `-lm` and `-lhappy` to `m.lib` and
`happy.lib` for the link line on Windows. So these should be something like
"{{(-l)?m(\.lib)?}}" "{{(-l)?happy(\.lib)?}}" to work on Windows.
libomp is linked differently on Windows, and doesn't end up last with this
change. I'm not sure how much that matters; perhaps limit that part of the test
to Linux only (e.g. with -target=aarch64-unknown-linux-gnu; since you're using
-### already it doesn't matter if that target is actually compiled or not)
https://github.com/llvm/llvm-project/pull/117573
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits