[flang-commits] [clang] [flang] [flang][driver] Make -stdlib= option visible to flang and silently ignored by it (PR #110598)
Paul Osmialowski via flang-commits
flang-commits at lists.llvm.org
Thu Oct 3 03:24:04 PDT 2024
pawosm-arm wrote:
> I don't think it is correct to say that the option was ignored. It may still be read by the compiler driver (which generates the link line). In fact it probably _should_ be processed by the compiler driver in order to set the C++ standard library correctly - otherwise you could just not set this in your `LDFLAGS`.
But this (ignoring) is exactly that is happening. Contrary to classic flang, flang-new cannot be used to mix C++ and Fortran code in one compiler invocation, and working on this patch I've even found a test case guarding that controversial decision (`driver-error-cc1.cpp`). This is something that would probably trigger further discussion as angry users may soon emerge as flang-new's popularity grows, but for now, I've found that even if I have a project for which its Makefile builds C++ and Fortran sources separately, it fails at link time if I'm trying to use specific standard C++ library by setting designated CMake flag (which in turn, sets C++ and linker flags for the project globally). I could go through all CMake generated link.txt files and adjust the flags, but this exposes a terrible user experience as: 1) the user must be experienced enough to know how this must be modified 2) it introduces annoying extra step between cmake invocation and make/ninja invocation.
Using this flag for compilation of a Fortran code will display a warining:
```
flang-new: warning: argument unused during compilation: '-stdlib=platform' [-Wunused-command-line-argument]
```
...and this is expected. Using this flag for linking will not do anything, looking at `-###` output with and without using this flag shows no difference, ergo it is being ingored.
https://github.com/llvm/llvm-project/pull/110598
More information about the flang-commits
mailing list