[flang] [clang] [flang][driver] Add support for -isysroot in the frontend (PR #77365)

Leandro Lupori via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 12:36:31 PST 2024


================
@@ -0,0 +1,12 @@
+! Verify that the -isysroot flag is known to the frontend and, on Darwin,
+! is passed on to the linker.
+
+! RUN: %flang -### --target=aarch64-apple-darwin -isysroot /path/to/sysroot \
+! RUN:        %s 2>&1 | FileCheck %s --check-prefix=CHECK-DARWIN
+! RUN: %flang -### --target=aarch64-linux-gnu -isysroot /path/to/sysroot \
+! RUN:        %s 2>&1 | FileCheck %s --check-prefix=CHECK-LINUX
+
+! CHECK-DARWIN: "{{.*[\/]}}ld" {{.*}}"-syslibroot" "/path/to/sysroot"
+! Unused on Linux.
+! CHECK-LINUX: warning: argument unused during compilation: '-isysroot /path/to/sysroot'
----------------
luporl wrote:

There is actually a way to test generating executables on Darwin, by using the sysroot detected by CMake. I've added this test to `exec-darwin.f90`.
`FlangDriver.md` has been expanded with your suggestions. I guess that is enough for the docs, right?

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


More information about the cfe-commits mailing list