================ @@ -977,14 +977,51 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC, return true; } -void tools::addFortranRuntimeLibs(const ToolChain &TC, +void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, llvm::opt::ArgStringList &CmdArgs) { // These are handled earlier on Windows by telling the frontend driver to add // the correct libraries to link against as dependents in the object file. if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) { + // --whole-archive needs to be part of the link line to make sure + // that the main() function from Fortran_main.a is pulled in by + // the linker. + // + // We are using this --whole-archive/--no-whole-archive bracket w/o + // any further checks, because -Wl,--whole-archive at the flang + // driver's link line will not sucessfully complete, unless the user + // correctly specified -Wl,--whole-archive/-Wl,--no-whole-archive + // (e.g., -Wl,--whole-archive -ldummy -Wl,--no-whole-archive). ---------------- mjklemm wrote:
I can rephrase that comment into something like this: ``` // We are using this --whole-archive/--no-whole-archive bracket w/o // any further checks, because a user should correctly specify // -Wl,--whole-archive/-Wl,--no-whole-archive around specific // library (e.g., -Wl,--whole-archive -ldummy -Wl,--no-whole-archive). ``` Would be more acceptable? https://github.com/llvm/llvm-project/pull/73124 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits