[flang-commits] [flang] [flang] Fix flang tests on MacOS (PR #70811)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Mon Nov 6 13:49:55 PST 2023


================
@@ -10,7 +10,7 @@
 ! RUN: %flang -### -S -flto=jobserver %s 2>&1 | FileCheck %s --check-prefix=FULL-LTO
 
 ! Also check linker plugin opt for Thin LTO
-! RUN: %flang -### -flto=thin %s 2>&1 | FileCheck %s --check-prefix=THIN-LTO
+! RUN: %flang --target=x86_64-linux-gnu -### -flto=thin %s 2>&1 | FileCheck %s --check-prefix=THIN-LTO
----------------
luporl wrote:

It seems Darwin supports ThinLTO.
I tried to compile and link a few files with `-flto=thin` and it worked, both with `flang-new` and `clang++`.
The documentation also says ThinLTO is supported by Xcode's ld64: https://clang.llvm.org/docs/ThinLTO.html.

In this case, the problem is with the line
`! THIN-LTO: "-plugin-opt=thinlto"`,
that relies on a linker dependent flag.

On MacOS, there is no difference in the linker invocation with `-flto` and `-flto=thin`.

As this test file has several LTO tests and only the line above fails on MacOS, wouldn't it be better to add another `RUN` line that builds only for a specific target and uses another prefix, say `THIN-LTO-LINUX`?

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


More information about the flang-commits mailing list