gcov: Support for the most streamlined profile of LLVM-embedded-toolchain-for-Arm

1. Excerpted from: https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/blob/main/samples/src/cpp-baremetal-semihosting-prof/proflib.c
2. Since llvm profile supports more than just gcov, and some features have not yet been explored, two clang gcov implementations are supported after this patch
3. Using this lib only supports the gcov compilation options of "-fprofile-instr-generate -fcoverage-mapping"
4. This file is heavily dependent on the compiler clang version, and is currently aligned with ci, supporting 17.0.1 and below. 18 and above are not supported by this library due to different internal implementations of the compiler

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1
2024-11-07 20:02:05 +08:00
committed by Xiang Xiao
parent cd2633ddcc
commit b59e3616f4
7 changed files with 439 additions and 75 deletions
+28 -1
View File
@@ -29,11 +29,38 @@ config BUILTIN_TOOLCHAIN
endchoice
choice
prompt "Code coverage analysis support"
default COVERAGE_NONE
---help---
Select the code coverage analysis library
config COVERAGE_COMPILER_RT
bool "Builtin libclang_rt.profile"
select LIB_BUILTIN
select LIB_COMPILER_RT
default n
---help---
Compile the LLVM Compiler-rt library into the OS.
Support adding native rich compilation options "-fprofile-xxx"
config COVERAGE_MINI
bool "Builtin code coverage analysis mini library"
select LIB_BUILTIN
---help---
This is a mini version of the library, which is
used for code coverage analysis. If the toolchain
is clang, only support the compilation option
"-fprofile-instr-generate -fcoverage-mapping"
config COVERAGE_TOOLCHAIN
bool "Link toolchain gcov library to the OS"
---help---
Link the toolchain coverage library to the OS.
config COVERAGE_NONE
bool "Disable coverage function"
endchoice
choice
prompt "Builtin profile support"