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

Andrzej WarzyƄski via flang-commits flang-commits at lists.llvm.org
Fri Oct 4 00:37:47 PDT 2024


banach-space wrote:

We should avoid dummy flags like this - they are usually an indication of a larger issue. 

I don't want to block this and, as @Meinersbur points out, there are some "inherited issues" to consider too. However, I'd like to identify the right long-term solution here. If possible.

> I've specified the -stdlib=libc++ option globally, in the CXXFLAGS and LDFLAGS variables

Why are CXXFLAGS used when invoking a Fortran compiler? That's not correct, is it? 

`LDFLAGS` would make sense, but then `-stdlib=` should be treated as a linker flag and `flang-new` as a linker driver. In fact, it sounds like `-stdlib=` could fall into some special category:
* valid when **compiling** C++,
* invalid when **compiling** Fortran,
* valid when **linking** mixed C++ and Fortran object files.

To me it sounds like:
*  flags from `CXXFLAGS` should not be used in Fortran _compilation_ flows,
* `-stdlib=` should be flagged as a linker option (that seems to be missing?),
* `flang-new` should allow/ignore "linker" flags that are not "visible" in Fortran _compilation_ flows (as in, the "Visibility" logic could be tweaked).

If `-stdlib=` were to be made available in Fortran compilation, the help-text should be updated accordingly. 

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


More information about the flang-commits mailing list