Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

W-M-R
Copy link
Contributor

@W-M-R W-M-R commented Oct 30, 2024

Summary

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

Impact

!!!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

Testing

Using this lib only supports the gcov compilation options of "-fprofile-instr-generate -fcoverage-mapping", and __llvm_profile_dump output the results

image

@github-actions github-actions bot added Area: Tooling Area: Build system Area: Networking Effects networking subsystem Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: simulator Issues related to the SIMulator Arch: tricore Issues related to the TriCore architecture from Infineon Arch: x86_64 Issues related to the x86_64 architecture Arch: xtensa Issues related to the Xtensa architecture Area: File System File System issues Area: Memory Management Memory Management issues Area: OS Components OS Components issues Board: simulator Size: L The size of the change in this PR is large labels Oct 30, 2024
@github-actions github-actions bot removed Area: Tooling Area: Build system Area: Networking Effects networking subsystem Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: simulator Issues related to the SIMulator Arch: tricore Issues related to the TriCore architecture from Infineon Arch: x86_64 Issues related to the x86_64 architecture Arch: xtensa Issues related to the Xtensa architecture Area: File System File System issues Area: Memory Management Memory Management issues Board: simulator Size: L The size of the change in this PR is large labels Oct 30, 2024
@github-actions github-actions bot added the Size: M The size of the change in this PR is medium label Oct 30, 2024
@W-M-R W-M-R changed the title enhance gcov gcov: Support for the most streamlined profile of LLVM-embedded-toolchain-for-Arm Oct 30, 2024
@W-M-R
Copy link
Contributor Author

W-M-R commented Oct 30, 2024

This patch comes from https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/blob/main/samples/src/cpp-baremetal-semihosting-prof/proflib.c. Its implementation is more concise than rt.profile and focuses on gcov functions. Can we consider merging it? If we consider merging it, I will update this patch in the next step.

@anchao
Copy link
Contributor

anchao commented Oct 30, 2024

Do we have any research on GCC and CLANG gcov implementations? I am curious why we chose to use CLANG gcov implementations not GCC, (especially PR #14472 introduced a lot of clang runtime library implementations )

@xiaoxiang781216
Copy link
Contributor

Do we have any research on GCC and CLANG gcov implementations? I am curious why we chose to use CLANG gcov implementations not GCC, (especially PR #14472 introduced a lot of clang runtime library implementations )

the profile implementation is totally different from clang and gcc, so you can't use gcov library directly with clang.

@anchao
Copy link
Contributor

anchao commented Oct 30, 2024

Do we have any research on GCC and CLANG gcov implementations? I am curious why we chose to use CLANG gcov implementations not GCC, (especially PR #14472 introduced a lot of clang runtime library implementations )

the profile implementation is totally different from clang and gcc, so you can't use gcov library directly with clang.

so why choose CLANG not GCC ?

@xiaoxiang781216
Copy link
Contributor

xiaoxiang781216 commented Oct 30, 2024

Do we have any research on GCC and CLANG gcov implementations? I am curious why we chose to use CLANG gcov implementations not GCC, (especially PR #14472 introduced a lot of clang runtime library implementations )

the profile implementation is totally different from clang and gcc, so you can't use gcov library directly with clang.

so why choose CLANG not GCC ?

Which one should we use is decided by compiler: clang variant must use runtime profile, gcc variant must use gcov.

@W-M-R W-M-R force-pushed the gcov_profile branch 4 times, most recently from 93262e4 to b5dbe8b Compare November 4, 2024 12:01
libs/libc/gcov/lib_clang.c Outdated Show resolved Hide resolved
libs/libc/gcov/Kconfig Outdated Show resolved Hide resolved
…hain-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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: OS Components OS Components issues Size: M The size of the change in this PR is medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants