Skip to content

Commit 7bc57f0

Browse files
committed
[RISCV] Allow -mcmodel= to accept large for RV64
1 parent f6da009 commit 7bc57f0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,8 @@ void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
29062906
CM = "small";
29072907
else if (CM == "medany")
29082908
CM = "medium";
2909-
Ok = CM == "small" || CM == "medium";
2909+
Ok = CM == "small" || CM == "medium" ||
2910+
(CM == "large" && Triple.isRISCV64());
29102911
} else if (Triple.getArch() == llvm::Triple::x86_64) {
29112912
Ok = llvm::is_contained({"small", "kernel", "medium", "large", "tiny"},
29122913
CM);

clang/test/Driver/riscv-mcmodel.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@
1010
// RUN: %clang --target=riscv32 -### -c -mcmodel=medany %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
1111
// RUN: %clang --target=riscv64 -### -c -mcmodel=medany %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
1212

13+
// RUN: not %clang --target=riscv32 -### -c -mcmodel=large %s 2>&1 | FileCheck --check-prefix=ERR-LARGE %s
14+
// RUN: %clang --target=riscv64 -### -c -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
15+
1316
// SMALL: "-mcmodel=small"
1417
// MEDIUM: "-mcmodel=medium"
18+
// LARGE: "-mcmodel=large"
19+
20+
// ERR-LARGE: error: unsupported argument 'large' to option '-mcmodel=' for target 'riscv32'

0 commit comments

Comments
 (0)