[clang] 6b50540 - [Flang] remove whole-archive option for AIX linker (#76039)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 07:22:35 PST 2023


Author: madanial0
Date: 2023-12-21T10:22:30-05:00
New Revision: 6b505406a3403a9ab6c733ccf1fbcc52d9ca0601

URL: https://github.com/llvm/llvm-project/commit/6b505406a3403a9ab6c733ccf1fbcc52d9ca0601
DIFF: https://github.com/llvm/llvm-project/commit/6b505406a3403a9ab6c733ccf1fbcc52d9ca0601.diff

LOG: [Flang] remove whole-archive option for AIX linker (#76039)

The AIX linker does not support the `--whole-archive` option, removing
the option if the OS is AIX.

---------

Co-authored-by: Mark Danial <mark.danial at ibm.com>

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/CommonArgs.cpp
    flang/test/Driver/no-duplicate-main.f90

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 4f4bdac793bea7..6eb0ed8f3fed9a 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1174,8 +1174,9 @@ static void addFortranMain(const ToolChain &TC, const ArgList &Args,
   // The --whole-archive option 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. However, it shouldn't be used if it's already active.
-  // TODO: Find an equivalent of `--whole-archive` for Darwin.
-  if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX()) {
+  // TODO: Find an equivalent of `--whole-archive` for Darwin and AIX.
+  if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX() &&
+      !TC.getTriple().isOSAIX()) {
     CmdArgs.push_back("--whole-archive");
     CmdArgs.push_back("-lFortran_main");
     CmdArgs.push_back("--no-whole-archive");

diff  --git a/flang/test/Driver/no-duplicate-main.f90 b/flang/test/Driver/no-duplicate-main.f90
index b884e7ecd7f12a..88f4430828e090 100644
--- a/flang/test/Driver/no-duplicate-main.f90
+++ b/flang/test/Driver/no-duplicate-main.f90
@@ -1,4 +1,4 @@
-! UNSUPPORTED: system-windows, system-darwin
+! UNSUPPORTED: system-windows, system-darwin, system-aix
 
 ! RUN: %flang -x ir -o %t.c-object -c %S/Inputs/no_duplicate_main.ll
 ! RUN: %flang -o %t -c %s


        


More information about the cfe-commits mailing list