[flang] [clang] [flang][Driver] Let the linker fail on multiple definitions of main() (PR #73124)

Andrzej WarzyƄski via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 13:55:35 PST 2023


banach-space wrote:

> @mjklemm This PR caused some regressions of C-interop test cases in our local test run. The test cases typically have a Fortran main (compiled with Flang) that calls a C function (compiled with clang). 

Sorry that you are hitting this, but please note that compiling mixed sources is untested and as such not really supported yet. 

>The linking is by `flang-new`. The error looks like:
> 
> ```
> ld.lld: error: duplicate symbol: main
> >>> defined at ./bind_c09i.c
> >>>            bind_c09i.o:(.The_Code)
> >>> defined at Fortran_main.c
> >>>            Fortran_main.c.o:(.text.main+0x0) in archive ./libFortran_main.a
> flang-new: error: linker command failed with exit code 1 (use -v to see invocation)
> ```

Could you share a repro? This way we could start testing this properly. And claim that it's supported :)

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


More information about the cfe-commits mailing list