[flang] [clang] [flang][driver] Allow explicit specification of -lFortran_main (PR #78152)
Andrzej WarzyĆski via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 18 11:24:23 PST 2024
banach-space wrote:
> I don't know what is the right way to handle the case that users have conflicting flags specified.
This comment made me realise what might be the source of confusion/friction.
With `-fno-fortran-main` and `-lFortran_main`, there are two very different mechanisms to control the same thing - whether `Fortran_main.a` should be added to the linker invocation. If we replaced `-lFortran_main` with `-ffortran-main` then:
* your example would become `-fno-fortran-main -ffortran-main` and we know how to deal with this (the driver will simply use the rightmost flag)
* `-lFortran_main` would finally be hidden from end users - everyone seems to agree that that would be the right thing to do.
My suggestion:
* rename `Fortran_main.a` as e.g. `flang_fortran_main.a`,
* introduce `-ffortran-main` on top of `-fno-fortran-main`,
* disallow `-lFortran_main.a` and `-lflang_fortran_main.a` - this library should be kept as an implementation detail of Flang that can change in the future.
The final point is probably key. Flang might change how "main" is defined in the future and we should discourage anyone linking `Fortran_main.a` directly. Mostly to avoid creating dependency on something that's an implementation detail.
https://github.com/llvm/llvm-project/pull/78152
More information about the cfe-commits
mailing list