Open meow464 opened 2 years ago
Thanks for reporting this issue. I think there is a bug in the code and currently, it requires the two flags (-fno-fortran-main
and -Mnomain
) to be present to not have main. Please test this.
https://github.com/flang-compiler/classic-flang-llvm-project/blob/f645e319607d5d8c8eabfb0c7dcefa544f6bbcf9/clang/lib/Driver/ToolChains/CommonArgs.cpp#L124
The fix is to change the above code to something like the following,
&& !(Args.hasArg(options::OPT_Mnomain) ||
Args.hasArg(options::OPT_no_fortran_main)));
@kiranchandramohan I can build for macOS with those changes :+1: EDIT: I tested it on branch release_100
I came across this problem while compiling OpenBLAS on macOS. Calling flang with
-fno-fortran-main
does nothing, by using-v
you can see that ld still receives-lflangmain
. To trigger an error you can use-all_load
.This command line can be used to reproduce without building OpenBLAS:
The error:
Any tips as to why or where
-fno-fortran-main
is being ignored are appreciated.EDIT: Please let me know if this bug happens on other platforms.
-all_load
is a very apple flag. EDIT2:-lflangmain
is still added to the linker command line but the error can't be triggered because -all_load isn't available.