[flang] [clang] [flang][driver] Allow explicit specification of -lFortran_main (PR #78152)

Michael Klemm via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 09:19:51 PST 2024


mjklemm wrote:

I'm kind of split brain on this.  While I do see the issue, I'm not sure if this should be considered a bug or a user error.

One thing that come to my mind though is (remotely related to this) to have a command line flag that reports the proper libraries needed to successfully link a Fortran program using a different linker driver (e.g., clang).  Similar to what `mpif90 -showme:link` does for Open MPI:

```
$ mpif90 --showme:link
-I/net/software/x86_64/openmpi/5.0.x/aomp/include -I/net/software/x86_64/openmpi/5.0.x/aomp/lib -L/net/software/x86_64/openmpi/5.0.x/aomp/lib -Wl,-rpath -Wl,/net/software/x86_64/openmpi/5.0.x/aomp/lib -Wl,--enable-new-dtags -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
```

So, this would look like this at the moment:

```
$ flang -fshow-me-link-line
 "-L/net/software/x86_64/llvm-ml/20231225/lib" "--whole-archive" "-lFortran_main" "--no-whole-archive" "-lFortranRuntime" "-lFortranDecimal" "-lm"
```


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


More information about the cfe-commits mailing list