[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
Thu Oct 17 02:06:43 PDT 2024


Meinersbur wrote:

> I don’t personally think that the flang driver should ever attempt to link a C++ library of any kind. FWIW while there’s no stdlib option to consider in their case, g++ will never auto link the gfortran runtimes and gfortran will never auto link libstdc++

gfortran doesn't have a flag that means "use this C++ standard library". Without this PR, Flang doesn't either which would be fine with me. OP would need to fix their build system.

With this PR, `flang --help` will list an option `-stdlib` with the help text "C++ standard library to use". But it doesn't do anything. It feels like it would be ignoring `-lc++`.


> If we were to do things this way, what should flang do if no -stdlib flag is provided? Should it link the default C++ stdlib as clang++ does, or break with clang++ and not link any C++ stdlib if nothing is provided? Both would be surprising behavior in my opinion, and both would also risk breaking the existing cmake support.

No `-stdlib` means no linking to any C++ standard library for Flang, no change of behavior without the flag. It also does not break cmake support since it never passes `-stdlib` by itself. Just asking for the flag's behavior to match its description. 


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


More information about the cfe-commits mailing list