[clang] [flang] [clang][driver] Special care for -l flags in config files (PR #117573)

David Truby via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 04:55:48 PST 2024


================
@@ -61,3 +61,24 @@
 ! 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 --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -o %s.out %s -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING
----------------
DavidTruby wrote:

Can you add a run line for Windows (`--target=x86_64-pc-windows-msvc` or similar) with e.g. -check-prefix CHECK-WINDOWS and something along the lines of:
```
CHECK-WINDOWS: -ffast-math
CHECK-WINDOWS-SAME: -Bstatic -Bdynamic 
CHECK-WINDOWS-SAME: "{{.*}}-{{.*}}.o" "m.lib" "happy.lib"
```
(the Bstatic and Bdynamic options shouldn't be moved, as they aren't recognised as linker options for Windows targets. I've checked this locally from your patch)
And the same for the NOLINKING ones?
We will want to make sure this change is working for Windows too so I don't really want it to land before we have Windows tests as well. I can write them locally (since I have a Windows build) and attach a diff if that would help.

https://github.com/llvm/llvm-project/pull/117573


More information about the cfe-commits mailing list