Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ New Compiler Flags
------------------
- New option ``-fno-sanitize-annotate-debug-info-traps`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).

Lanai Support
^^^^^^^^^^^^^^
- The option ``-mcmodel={small,medium,large}`` is supported again.

Deprecated Compiler Flags
-------------------------

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/CommonArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,8 @@ void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
else if (CM == "medany")
CM = "large";
Ok = CM == "small" || CM == "medium" || CM == "large";
} else if (Triple.getArch() == llvm::Triple::lanai) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if there is an ordering here, but I can't really see one, so at end SG,

Ok = llvm::is_contained({"small", "medium", "large"}, CM);
}
if (Ok) {
CmdArgs.push_back(Args.MakeArgString("-mcmodel=" + CM));
Expand Down
10 changes: 10 additions & 0 deletions clang/test/Driver/lanai-mcmodel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %clang --target=lanai -### -c -mcmodel=small %s 2>&1 | FileCheck --check-prefix=SMALL %s
// RUN: %clang --target=lanai -### -c -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
// RUN: %clang --target=lanai -### -c -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
// RUN: not %clang --target=lanai -### -c -mcmodel=something %s 2>&1 | FileCheck --check-prefix=ERR-MCMODEL %s

// SMALL: "-mcmodel=small"
// MEDIUM: "-mcmodel=medium"
// LARGE: "-mcmodel=large"

// ERR-MCMODEL: error: unsupported argument 'something' to option '-mcmodel=' for target 'lanai'
Loading