[Openmp-commits] [clang] [llvm] [clang-tools-extra] [libc] [compiler-rt] [libcxx] [openmp] [mlir] [lldb] [flang] [libcxxabi] [lld] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

Martin Storsjö via Openmp-commits openmp-commits at lists.llvm.org
Fri Dec 15 01:15:27 PST 2023


mstorsjo wrote:

This commit broken building compiler-rt builtins for Windows on aarch64; building now hits these errors:
```
llvm-project/compiler-rt/lib/builtins/cpu_model.c:1192:2: error: No support for checking for lse atomics on this platfrom yet.
 1192 | #error No support for checking for lse atomics on this platfrom yet.
      |  ^
llvm-project/compiler-rt/lib/builtins/cpu_model.c:1571:2: error: No support for checking hwcap on this platform yet.
 1571 | #error No support for checking hwcap on this platform yet.
      |  ^
2 errors generated.
```
Before this change, most of this whole file was ifdeffed out when building on Windows (and Apple platforms, I would presume), but now most of it is included, then hitting this `#error`.

I guess it could work to just remove the `#error` cases, but this file suffers from a pretty deep ifdef nesting jungle, so I'm not sure if that's the best solution. (FWIW, if we wanted to add aarch64 CPU feature detection for Windows here, the code would be more of a separate codepath just like the Apple case, it doesn't share the linux/BSD HWCAP style.)

I can push a quick fix, either removing the `#error` or reverting this commit, later during the day.

BTW, when compiling the file I also get a bunch of warnings in this style:
```
llvm-project/compiler-rt/lib/builtins/cpu_model.c:1448:36: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
 1448 |     getCPUFeature(ID_AA64PFR1_EL1, ftr);
      |                                    ^
llvm-project/compiler-rt/lib/builtins/cpu_model.c:1448:5: note: use constraint modifier "w"
 1448 |     getCPUFeature(ID_AA64PFR1_EL1, ftr);
      |     ^
llvm-project/compiler-rt/lib/builtins/cpu_model.c:1345:45: note: expanded from macro 'getCPUFeature'
 1345 | #define getCPUFeature(id, ftr) __asm__("mrs %0, " #id : "=r"(ftr))
      |
```

https://github.com/llvm/llvm-project/pull/73685


More information about the Openmp-commits mailing list