-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[Driver] Reject -mcmodel=tiny on X86 #125643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
0aebcd7
f791b1d
689dc3a
28fcb0e
ba6c662
843d4cc
adf4236
cb512f3
b2724ba
ad5c8ca
5b9ff44
0fa223c
d85fad3
ca4d129
fcbc340
d2cf187
8e2b440
12e4423
215aa42
39e7667
2024997
075a921
742ea57
59985ea
0c14a0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1755,6 +1755,18 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) { | |
| << TC.getTriple().str(); | ||
| } | ||
|
|
||
| // Throw diagnosis if mcmodel=tiny option is passed for targets other than ARM | ||
| // or AArch64. | ||
| if (Arg *A = UArgs->getLastArg(options::OPT_mcmodel_EQ)) { | ||
|
||
| StringRef ModelName = A->getValue(); | ||
| if (ModelName == "tiny" && | ||
| !(TC.getTriple().getArch() == llvm::Triple::aarch64 || | ||
| TC.getTriple().getArch() == llvm::Triple::arm)) { | ||
| Diag(diag::err_drv_unsupported_option_argument_for_target) | ||
| << A->getSpelling() << ModelName << TC.getTriple().str(); | ||
| } | ||
| } | ||
|
|
||
| // A common user mistake is specifying a target of aarch64-none-eabi or | ||
| // arm-none-elf whereas the correct names are aarch64-none-elf & | ||
| // arm-none-eabi. Detect these cases and issue a warning. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // RUN: not %clang -### -c --target=i686 -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s | ||
| // RUN: %clang --target=x86_64 -### -c -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=TINY %s | ||
| // RUN: not %clang --target=x86_64 -### -c -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=TINY %s | ||
AaronBallman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // RUN: %clang --target=x86_64 -### -c -mcmodel=small %s 2>&1 | FileCheck --check-prefix=SMALL %s | ||
| // RUN: %clang --target=x86_64 -### -S -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=KERNEL %s | ||
| // RUN: %clang --target=x86_64 -### -c -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s | ||
|
|
@@ -44,3 +44,5 @@ | |
| // ERR-AARCH64_32: error: unsupported argument 'small' to option '-mcmodel=' for target 'aarch64_32-unknown-linux' | ||
|
|
||
| // ERR-LOONGARCH64-PLT-EXTREME: error: invalid argument '-mcmodel=extreme' not allowed with '-fplt' | ||
|
|
||
| // CHECK: error: unsupported argument 'tiny' to option '-mcmodel=' for target '{{.*}}' | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message/description and the note should be changed. Only X86 is affected. This change is pretty niche and does not deserve a release note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaskRay, Thank you for the response. I have removed the release note entry and updated the commit message as well.