[flang-commits] [clang] [flang] [flang][driver] Allow explicit specification of -lFortran_main (PR #78152)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Mon Jan 15 06:21:51 PST 2024
================
@@ -1200,6 +1200,14 @@ static void addFortranMain(const ToolChain &TC, const ArgList &Args,
// TODO: Find an equivalent of `--whole-archive` for Darwin and AIX.
if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX() &&
!TC.getTriple().isOSAIX()) {
+ // Adding -lFortran_main with --whole-archive will create an error if the
+ // user specifies -lFortran_main explicitly. Remove the user's
+ // -lFortran_main arguments to avoid this (making sure -lFortran_main
+ // behaves the same as -lFortranRuntime)
+ llvm::erase_if(CmdArgs, [](const char *arg) {
+ return strcmp(arg, "-lFortran_main") == 0;
----------------
kiranchandramohan wrote:
Nit: I think you should use `strncmp` here.
https://github.com/llvm/llvm-project/pull/78152
More information about the flang-commits
mailing list