Skip to content

Commit 4704eaf

Browse files
authored
[PowerPC] Support more mcmodel options for AIX (llvm#70652)
7e42545 rejects unsupported mcmodel options, but small and large should be a supported model for 32-bit AIX targets.
1 parent 9627602 commit 4704eaf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5726,16 +5726,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
57265726
if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
57275727
StringRef CM = A->getValue();
57285728
bool Ok = false;
5729-
if (Triple.isOSAIX() && CM == "medium") {
5729+
if (Triple.isOSAIX() && CM == "medium")
57305730
CM = "large";
5731-
Ok = true;
5732-
}
57335731
if (Triple.isAArch64(64)) {
57345732
Ok = CM == "tiny" || CM == "small" || CM == "large";
57355733
if (CM == "large" && RelocationModel != llvm::Reloc::Static)
57365734
D.Diag(diag::err_drv_argument_only_allowed_with)
57375735
<< A->getAsString(Args) << "-fno-pic";
5738-
} else if (Triple.isPPC64()) {
5736+
} else if (Triple.isPPC64() || Triple.isOSAIX()) {
57395737
Ok = CM == "small" || CM == "medium" || CM == "large";
57405738
} else if (Triple.isRISCV()) {
57415739
if (CM == "medlow")

clang/test/Driver/mcmodel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// RUN: %clang --target=x86_64 -### -c -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
66
// RUN: %clang --target=x86_64 -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
77
// RUN: not %clang -### -c --target=powerpc-linux-gnu -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s
8+
// RUN: %clang --target=powerpc-unknown-aix -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=SMALL %s
9+
// RUN: %clang --target=powerpc-unknown-aix -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
810
// RUN: %clang --target=powerpc-unknown-aix -### -S -mcmodel=medium %s 2> %t.log
911
// RUN: FileCheck --check-prefix=AIX-MCMEDIUM-OVERRIDE %s < %t.log
1012
// RUN: not %clang -### -c -mcmodel=lager %s 2>&1 | FileCheck --check-prefix=INVALID %s

0 commit comments

Comments
 (0)