[all-commits] [llvm/llvm-project] 7e4254: [Driver] Reject unsupported -mcmodel= (#70262)

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Oct 26 14:15:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7e4254552481dbc4089b91941273ff8c42a7113c
      https://github.com/llvm/llvm-project/commit/7e4254552481dbc4089b91941273ff8c42a7113c
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c
    M clang/test/Driver/mcmodel.c
    M clang/test/Driver/riscv-sdata-warning.c
    M clang/test/Preprocessor/init-x86.c

  Log Message:
  -----------
  [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.




More information about the All-commits mailing list