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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to