[flang-commits] [flang] [clang] [flang][Driver] Let the linker fail on multiple definitions of main() (PR #73124)
Ricardo Jesus via flang-commits
flang-commits at lists.llvm.org
Fri Dec 8 02:00:32 PST 2023
rj-jesus wrote:
> The solution is to add `-fno-fortran-main` to the linker options via `CMAKE_SHARED_LINKER_FLAGS`. This will need PR #74139 land first. But this option will be a good way to control if the flang compiler should attempt linking in the `main` stub from its library.
>
> It seems like `flang-new` when being used as a linker with `-shared` included Fortran_main in the shared library. This seems wrong to me. The option `-fno-fortran-main` avoids this. I'm pondering if `-shared` is buggy here. It will require a bit more digging on my end to figure that out.
Thanks, sounds like a good workaround to me, though as you say I find strange the need to explicitly specify "don't include main" when building a library!
https://github.com/llvm/llvm-project/pull/73124
More information about the flang-commits
mailing list