[all-commits] [llvm/llvm-project] 5fd5f8: [Driver] Mark m_x86_Features_Group options as Targ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Aug 3 19:05:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fd5f8027fa196913138a34082a933abd5be0b4e
      https://github.com/llvm/llvm-project/commit/5fd5f8027fa196913138a34082a933abd5be0b4e
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/test/Driver/x86-target-features.c

  Log Message:
  -----------
  [Driver] Mark m_x86_Features_Group options as TargetSpecific

so that they lead to an error when compiled for non-x86 targets.
Follow-up to D151590.

```
% aarch64-linux-gnu-gcc -c -mavx a.c
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mavx’
% clang --target=aarch64-unknown-linux-gnu -c -mavx a.c  # without this patch
clang: warning: argument unused during compilation: '-mavx' [-Wunused-command-line-argument]
...

% clang --target=aarch64-unknown-linux-gnu -c -mavx a.c  # with this patch
clang: error: unsupported option '-mavx' for target 'aarch64-unknown-linux-gnu'
```

As a workaround for https://github.com/llvm/llvm-project/issues/63270, we don't
report an error for -msse4.2.

Reviewed By: pengfei, skan

Differential Revision: https://reviews.llvm.org/D156962




More information about the All-commits mailing list