[compiler-rt] [compiler-rt] Build the builtins library for AArch64 big endian (PR #225996)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 02:46:23 PDT 2026
https://github.com/smithp35 commented:
I'm not a CMake expert, will have to leave detailed review to the Runtimes reviewers.
The Description will become the commit message. Please can you reword it inline with the developer policy https://llvm.org/docs/DeveloperPolicy.html#id2 . The description also looks AI assisted; if it is, please disclose it. Bear in mind that there is a discussion in Discourse https://discourse.llvm.org/t/rfc-forbid-ai-generated-communication/92414 about this so I recommend writing by hand, and only using AI for translation and refinement.
If there are additional sections needed for testing, please put these in comments rather than the description.
We already build big-endian compiler-rt builtins for the bare-metal aarch64-none-elf toolchain in https://github.com/arm/arm-toolchain/ this can be achieved by passing -mbig-endian in the C, CXX and ASM flags.
I guess this change would permit `--target=aarch64_be` to infer `-mbig-endian`?
I made a quick proof of concept to show that using -mbig-endian can work for Linux. I used a Linaro GCC big-endian sysroot for header files.
```
cmake ../runtimes -G Ninja \
-DCMAKE_ASM_COMPILER=clang\
-DCMAKE_ASM_COMPILER_TARGET=aarch64-linux-gnu \
-DCMAKE_ASM_FLAGS="-mbig-endian --sysroot=/path/to/gcc/aarch64_be-linux-gnu/libc" \
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
-DCMAKE_CXX_COMPILER=clang++\
-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu \
-DCMAKE_CXX_FLAGS="-mbig-endian --sysroot=/path/to/gcc/aarch64_be-linux-gnu/libc" \
-DCMAKE_C_COMPILER=clang\
-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu \
-DCMAKE_C_FLAGS="-mbig-endian --sysroot=/path/to/gcc/aarch64_be-linux-gnu/libc" \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DCOMPILER_RT_BUILD_PROFILE=OFF \
-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
-DCOMPILER_RT_BUILD_ORC=OFF \
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
-DLLVM_ENABLE_RUNTIMES=compiler-rt
```
That will build compiler-rt/lib/linux/libclang_rt.builtins-aarch64.a which I checked is big-endian.
https://github.com/llvm/llvm-project/pull/225996
More information about the llvm-commits
mailing list