huojianchaoyy opened a new pull request, #22390: URL: https://github.com/apache/nuttx/pull/22390
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This takes over #21351 by @W-M-R: rebased on master, with the review comments addressed. Two commits from Xiaomi Vela that let compiler-rt 21 build. The default `LIB_COMPILER_RT_VERSION` stays 17.0.1. - **build(compiler-rt): add LLVM 21 new builtins to exclusion lists**: the builtins that LLVM 21 adds for bfloat16 (`trunctfbf2.c`, `truncxfbf2.c`, `extendbfsf2.c`) and for the x86 80-bit type (`extendhfxf2.c`, `truncxfhf2.c`, `truncxfbf2.c`) are left out where those types are not supported, in `Make.defs` and in `CMakeLists.txt`. - **build(compiler-rt): support the LLVM 21 profile API in InstrProfilingPlatform**: the vtable stubs (`INSTR_PROF_VTAB_COMMON`, from LLVM 19 on) and the covinit stubs (`INSTR_PROF_COVINIT_COMMON`, from LLVM 20 on) are added under their section macros. The orderfile stub stays, under `INSTR_PROF_ORDERFILE_COMMON`, for LLVM 17 to 20. So the file builds with the headers of every version. compiler-rt's own `InstrProfilingPlatformOther.c` is no longer built: from 18.1.8 on it does not compile here (`BitmapFirst` and `BitmapLast` are undeclared), and every function it defines is defined by `InstrProfilingPlatform.c` as well. ## Impact - Only builds with `CONFIG_LIB_COMPILER_RT` (`BUILTIN_COMPILER_RT` or `COVERAGE_COMPILER_RT`) change; the default version is still 17.0.1. - `InstrProfilingPlatformOther.c` is not compiled for any version any more. ## Testing Host: Ubuntu 22.04 x86_64, Arm Toolchain for Embedded 21.1.1 (clang), Arm GNU Toolchain 13.2.rel1, CMake 3.23 + Ninja 1.10. Base: master 4f8706c4b35. `./tools/checkpatch.sh -c -u -m -g HEAD~2..HEAD` passes. `mps3-an547:clang` with `CONFIG_COVERAGE_COMPILER_RT=y` (for CMake the options go into the defconfig, as compiler-rt is fetched at the first configure): | | make | CMake | |---|---|---| | master, compiler-rt 17.0.1 | OK | | | this PR without the `InstrProfilingPlatformOther.c` filter, 21.1.1 | `InstrProfilingPlatformOther.c:107:50: error: use of undeclared identifier 'BitmapFirst'` | same error | | this PR, 17.0.1 | OK | OK | | this PR, 21.1.1 | OK | OK | With `CONFIG_COVERAGE_ALL=y` as well, the link has no duplicate or undefined symbol with either version, but the instrumented image does not fit in the flash of mps3-an547, on master too. `mps3-an547:nsh` with `CONFIG_BUILTIN_COMPILER_RT=y` and compiler-rt 21.1.1, `make -k` (GCC): master fails in `extendhfxf2.c` and `truncxfhf2.c` and in the four `atomic_flag_*.c`; with the first commit only the `atomic_flag_*.c` fail (`'atomic_flag' has no member named '_Value'`), which they do with compiler-rt 17.0.1 and GCC as well (an existing problem, not changed here). Not tested: clang 17, running the profile runtime on a target. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
