huojianchaoyy opened a new pull request, #22597: URL: https://github.com/apache/nuttx/pull/22597
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Coverage patches from Xiaomi Vela. This is the first of four PRs that bring the coverage runtime and PGO support up to date; the others build on it. - **arch/xtensa: add gcov support**: adds the coverage options to the xtensa toolchain files for Make (lx6, lx7) and CMake: `-fprofile-arcs -ftest-coverage -fno-inline` for GCC and `-fprofile-instr-generate -fcoverage-mapping` for Clang with `CONFIG_COVERAGE_ALL`. The ESP toolchain now selects `ARCH_TOOLCHAIN_GCC` (which selects `ARCH_TOOLCHAIN_GNU`) because these options and the coverage runtimes test it. - **libs/coverage: fix compile error.**: `compiler-rt/coverage.c` uses `_NX_CLOSE()`, which is `close()` in user space, without `<unistd.h>`; Clang rejects the implicit declaration. One pre-existing style fix goes first: **libs/libbuiltin/compiler-rt: add the blank line after a declaration**, a missing blank line in `__llvm_profile_dump()` that nxstyle reports. No functional change. ## Impact - xtensa: `CONFIG_COVERAGE_ALL` now instruments the build. Builds without it are unchanged. - ESP xtensa toolchain: selects `ARCH_TOOLCHAIN_GCC` in addition to `ARCH_TOOLCHAIN_GNU`. ## Testing Host: Ubuntu 22.04 (Linux 6.8, x86_64), host GCC 13.4, aarch64-none-elf-gcc 13.4, arm-none-eabi-gcc 13.2.1, CMake 3.23 with Ninja. Base: master bec2b2a11e8. `./tools/checkpatch.sh -c -u -m -g HEAD~3..HEAD` passes. Each commit builds in these configurations (`CONFIG_COVERAGE_MINI=y`, `CONFIG_COVERAGE_ALL=y` unless noted): - `sim:nsh` (Make and CMake) - `qemu-armv8a:nsh` (CMake), `qemu-armv8a:nsh_smp` (Make), `qemu-armv8a:knsh` (Make) - `fvp-armv8r:pnsh` (Make) - `qemu-armv7r:pnsh` (Make, `CONFIG_COVERAGE_MINI` only, because the instrumented image does not fit in kflash) - `qemu-armv8a:nsh` without coverage (CMake) Not tested: xtensa targets (no xtensa toolchain on this host). -- 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]
