Skip to content

Commit 6b50540

Browse files
authored
[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@ibm.com>
1 parent 8eccf2b commit 6b50540

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,8 +1174,9 @@ static void addFortranMain(const ToolChain &TC, const ArgList &Args,
11741174
// The --whole-archive option needs to be part of the link line to make
11751175
// sure that the main() function from Fortran_main.a is pulled in by the
11761176
// linker. However, it shouldn't be used if it's already active.
1177-
// TODO: Find an equivalent of `--whole-archive` for Darwin.
1178-
if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX()) {
1177+
// TODO: Find an equivalent of `--whole-archive` for Darwin and AIX.
1178+
if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX() &&
1179+
!TC.getTriple().isOSAIX()) {
11791180
CmdArgs.push_back("--whole-archive");
11801181
CmdArgs.push_back("-lFortran_main");
11811182
CmdArgs.push_back("--no-whole-archive");

flang/test/Driver/no-duplicate-main.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! UNSUPPORTED: system-windows, system-darwin
1+
! UNSUPPORTED: system-windows, system-darwin, system-aix
22

33
! RUN: %flang -x ir -o %t.c-object -c %S/Inputs/no_duplicate_main.ll
44
! RUN: %flang -o %t -c %s

0 commit comments

Comments
 (0)