[clang] [flang] [flang][driver] Make -stdlib= option visible to flang and silently ignored by it (PR #110598)

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 13:12:49 PDT 2024


Meinersbur wrote:

@DavidTruby So CMake adds `-lFortranRuntime -lFortranDecimal` itself? I did not expect that, usually the flang-new driver would be responsible for that. 

I found how CMake does it: https://github.com/Kitware/CMake/blob/ee2eadb252708b2401da99b8ccc69d6501c7143f/Modules/CMakeDetermineFortranCompiler.cmake#L246
There's even a workaround for Flang-RT on Windows forgetting that it has a dependency on `clang_rt.builtins.lib`.

I don't think we can rely on every build system doing that, so I would still advocate that `-stdlib=libc++` is not just ignored, but actually adds the C++ standard library linker flags (see https://github.com/llvm/llvm-project/pull/110598#issuecomment-2388005207) to support such language-combination scenarios using e.g. GNU Autotools (if feasible to do so without e.g. copy&pasting functions from the clang driver). Just ignoring it so an error goes away feels ... wrong.

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


More information about the cfe-commits mailing list