Skip to content

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 Size: M The size of the change in this PR is medium and 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
@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.

@lupyuen
Copy link
Member

lupyuen commented Nov 7, 2024

Sorry I have to cancel the CI Check, there's a problem with CI Test:

@W-M-R W-M-R closed this Nov 11, 2024
@W-M-R W-M-R deleted the gcov_profile branch November 11, 2024 03:47
@W-M-R W-M-R restored the gcov_profile branch November 11, 2024 12:36
@W-M-R
Copy link
Contributor Author

W-M-R commented Nov 11, 2024

Sorry, I accidentally closed this PR

@W-M-R W-M-R reopened this Nov 11, 2024
@xiaoxiang781216
Copy link
Contributor

rebase the patch @W-M-R

@github-actions github-actions bot added Area: Tooling Area: CI Board: arm Size: L The size of the change in this PR is large and removed Size: M The size of the change in this PR is medium labels Nov 12, 2024
@github-actions github-actions bot added the Arch: simulator Issues related to the SIMulator label Nov 12, 2024
@W-M-R
Copy link
Contributor Author

W-M-R commented Nov 12, 2024

depends on apache/nuttx-apps#2842

…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 <wangmingrong1@xiaomi.com>
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
@xiaoxiang781216 xiaoxiang781216 merged commit 1d1ef52 into apache:master Nov 12, 2024
@W-M-R W-M-R deleted the gcov_profile branch November 13, 2024 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: simulator Issues related to the SIMulator Area: CI Area: OS Components OS Components issues Area: Tooling Board: arm Board: simulator Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants