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

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Fri Oct 4 02:50:35 PDT 2024


Meinersbur wrote:

>From the summary?

> This has created a nowhere to go situation, the only remaining option is to make the -stdlib flag visible to flang and silently ignored.

Can you clarify? I think it is not ignored, otherwise the test would fail since it requires linking to the `<iostream>` implementation. It must add `-l(std)c++` to the linker command line.


> > (and there isn't even a warning that the option is unused)
> > @pawosm-arm Wasn't this ever an issue? Should those to be consistent?
> 
> Interesting, clang would do the same as flang-new patched with my patch. Maybe addition of the warning would be a good idea, if it isn't an overkill.

AFAICS your patch only makes the `-stdlib` recognized by Flang. `lc++` being added must have been inherited from the C++ driver, but seemingly missing from the C driver path. 
A lot of flags are purposefully by the driver because build systems typically pass the same flags to every build phase which would otherwise cause errors ([example](https://github.com/llvm/llvm-project/issues/88173)). A warning usually only annoys people that compile with `-werror`.

> what I've noticed is that using -DLLVM_ENABLE_LIBCXX=True CMake flag has unexpected effect when it comes to C++/Fortran mixed code.

What effects?

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


More information about the flang-commits mailing list