Commit 5eaae2d
committed
[compiler-rt][AArch64] Enable libc-free builtins Linux build
Without this change, libc++abi.so.1.0 fails to link with:
```
error: undefined sybol: __aarch64_sme_accessible
```
This symbol is provided by baremetal libc's such as newlib.
In order to compile a libc with compiler-rt, it is necessary first to
build a compiler-rt with no dependency on libc to acquire the builtins.
The intended linux test requires getauxval which is provided by libc.
To that end, there are examples in the wild of building a compiler-rt
without libc by specifying -DCOMPILER_RT_BAREMETAL_BUILD=ON.
On Linux, this gives a builtins build with (almost) no libc dependencies.
See for example:
https://github.com/NixOS/nixpkgs/blob/d7fe3bcaca37e79d8b3cbde4dd69edeafbd35313/pkgs/development/compilers/llvm/common/compiler-rt/default.nix#L116-L118
```
] ++ lib.optionals (!haveLibc || bareMetal) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
```
The above specifies that a !haveLibc build sets
`-DCOMPILER_RT_BAREMETAL_BUILD`, which is done for example in a `pkgsLLVM` build.
AIUI, acquiring such a builtins build of compiler-rt is necessary to build a
pure LLVM toolchain, since builtins are required to build libc (and
libcxx is required to build a full compiler-rt).
The effect of falling back to unimplemented is that this early-stage
builtins build is incapable of doing function multiversioning tests and
falls back to behaving as-if the feature is unavailable.
This behaviour changed in
#119414, which introduced a
subtle change in semantics in the removal of
compiler-rt/lib/builtins/aarch64/sme-abi-init.c (definition of getauxval
macro, which was bracketed by `#if defined(__linux__)`) vs the new
definition which does not test for linux.
The proposed change is reinstating things as they were before #119414.1 parent a57bbff commit 5eaae2d
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
0 commit comments