8 Commits

Author SHA1 Message Date
Lu Weining
1296d20adf
[Driver] Support -mcmodel= for LoongArch (#72514)
7e42545 rejects unsupported mcmodel options, but normal/medium/extreme
should be supported models for LoongArch according to [gcc
document](https://gcc.gnu.org/onlinedocs/gcc/LoongArch-Options.html).

The mappings among `gcc`, `clang driver`, `clang cc1` and `LLVM (i.e.
llc --code-model=)` are:

|     gcc      |  clang driver |  clang cc1   |    LLVM    |
| -------------  | ------------------ | ----------------- | -------------- |
| normal    |      normal     |   small        |    small    |
| medium  |     medium     |   medium    |    medium |
| extreme  |     extreme     |  large         |     large     |

Link: https://reviews.llvm.org/D150522
2023-11-30 14:08:45 +08:00
Qiu Chaofan
4704eaf234
[PowerPC] Support more mcmodel options for AIX (#70652)
7e42545 rejects unsupported mcmodel options, but small and large
should be a supported model for 32-bit AIX targets.
2023-11-06 13:24:07 +08:00
Fangrui Song
7e42545524
[Driver] Reject unsupported -mcmodel= (#70262)
-mcmodel= is supported for a few architectures. Reject the option for
other architectures.

* -mcmodel= is unsupported on x86-32.
* -mcmodel=large is unsupported for PIC on AArch64.
* -mcmodel= is unsupported for aarch64_32 triples.
* https://reviews.llvm.org/D67066 (for RISC-V) made
-mcmodel=medany/-mcmodel=medlow aliases for all architectures. Restrict
this to RISC-V.
* llvm/lib/Target/Sparc has some small/medium/large support, but the
values listed on https://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
had been supported before https://reviews.llvm.org/D67066. Consider
-mcmodel= unsupported for Sparc.
* https://reviews.llvm.org/D106371 translated -mcmodel=medium to
-mcmodel=large on AIX, even for 32-bit systems. Retain this behavior but
reject -mcmodel= for other PPC32 systems.

In general the accept/reject behavior is more similar to GCC.

err_drv_invalid_argument_to_option is less clear than
err_drv_unsupported_option_argument. As the supported values are
different for
different architectures, add a
err_drv_unsupported_option_argument_for_target
for better clarity.
2023-10-26 14:15:36 -07:00
Fangrui Song
8958f0dca0 [Driver][test] Improve mcmodel.c 2023-10-25 13:48:06 -07:00
Fangrui Song
1f5215668a [Driver][test] Replace legacy -target with --target= 2022-08-25 19:30:21 -07:00
Hsiangkai Wang
a869014305 [AArch64] Filter out invalid code model in frontend.
AArch64 only supports tiny, small, and large code model. Show error
messages when users specify other code model.

Fix https://github.com/llvm/llvm-project/issues/53402

Differential Revision: https://reviews.llvm.org/D132538
2022-08-25 23:28:28 +00:00
Anjan Kumar Guttahalli Krishna
7d669e6666 [AIX] Generate large code model relocations when mcmodel=medium on AIX
This patch makes the changes in the driver that converts the medium code
model to large.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D106371
2021-07-22 15:47:22 -04:00
Fangrui Song
fc6057e34f [Frontend] Replace CC1 option -mcode-model with -mcmodel=
Before:

% clang -mcmodel=x -xc /dev/null
error: invalid argument 'x' in '-mcode-model x'

Now:

% clang -mcmodel=x -xc /dev/null
clang-11: error: invalid argument 'x' to -mcmodel=
2020-02-21 23:10:50 -08:00