xen: Drop logic for old clang versions.
PATCH 1/1 xen: Drop logic for old clang versions.
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
---
Mentioned in https://gitlab.com/xen-project/xen/-/issues/201
--- xen/common/coverage/llvm.c | 4 ---- xen/include/xen/self-tests.h | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-)
xen/common/coverage/llvm.c +0 -4
@@ -44,12 +44,8 @@ ((uint64_t)'f' << 16) | ((uint64_t)'R' << 8) | ((uint64_t)129)#endif -#if __clang_major__ >=4 || (__clang_major__ ==3 && __clang_minor__ >=9 )#define LLVM_PROFILE_VERSION 4#define LLVM_PROFILE_NUM_KINDS 2 -#else -#error "clang version not supported with coverage" -#endif struct llvm_profile_data {uint64_t name_ref;
xen/include/xen/self-tests.h +1 -8
@@ -10,16 +10,12 @@#include <xen/lib.h> /* -* Check that fn(val) can be calcuated by the compiler, and that it gives the +* Check that fn(val) can be calculated by the compiler, and that it gives the * expected answer. * -* Clang < 8 can't fold constants through static inlines, causing this to -* fail. Simply skip it for incredibly old compilers. -* * N.B. fn is intentionally not bracketed to allow us to test function-like * macros too. */ -#if !defined(CONFIG_CC_IS_CLANG ) ||CONFIG_CLANG_VERSION >=80000 #define COMPILE_CHECK (fn, val, res) \ do { \ typeof(fn(val)) real = fn(val); \
@@ -29,9 +25,6 @@else if ( real != (res) ) \ BUILD_ERROR("Compile time check '" STR(fn(val) == res) "' failed"); \ }while (0 ) -#else -#define COMPILE_CHECK(fn, val, res) -#endif /* * Check that Xen's runtime logic for fn(val) gives the expected answer. This
Signature · 1 line
2.43.0
Quoted 8 lines · On Sun, Aug 10, 2025 at 03:03:53PM +0200, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>
Quoted 12 lines
---
Mentioned in https://gitlab.com/xen-project/xen/-/issues/201--- xen/common/coverage/llvm.c | 4 ---- xen/include/xen/self-tests.h | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-)xen/common/coverage/llvm.c +0
-0
xen/common/coverage/llvm.c line 52
Quoted 9 lines
xen/common/coverage/llvm.c +0
-4@@ -44,12 +44,8 @@ ((uint64_t)'f' << 16) | ((uint64_t)'R' << 8) | ((uint64_t)129)#endif -#if __clang_major__ >=4 || (__clang_major__ ==3 && __clang_minor__ >=9 )#define LLVM_PROFILE_VERSION 4#define LLVM_PROFILE_NUM_KINDS 2 -#else -#error "clang version not supported with coverage" -#endif
Rant: most of the LLVM coverage stuff is already kind of dead code, as the format of the data changes between versions and there's no way for LLVM to generate the blob itself using a builtin function or similar. We haven't kept up with new formats, and now it's not possible to parse the output coverage data when using newish LLVM versions.
Linux converts it's LLVM coverage data to gcov format (which AFAIK is way more stable), and exports it in gcov format. We should consider importing that from Linux.
Thanks, Roger.
Quoted 42 lines · Roger Pau Monné
Quoted 8 lines · On Sun, Aug 10, 2025 at 03:03:53PM +0200, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Acked-by Roger Pau Monné <[email protected]>Quoted 12 lines
---
Mentioned in https://gitlab.com/xen-project/xen/-/issues/201--- xen/common/coverage/llvm.c | 4 ---- xen/include/xen/self-tests.h | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-)xen/common/coverage/llvm.c +0
-0xen/common/coverage/llvm.c line 53
Quoted 10 lines
xen/common/coverage/llvm.c +0
-4@@ -44,12 +44,8 @@ ((uint64_t)'f' << 16) | ((uint64_t)'R' << 8) | ((uint64_t)129) #endif -#if __clang_major__ >=4 || (__clang_major__ ==3 && __clang_minor__ >= 9)#define LLVM_PROFILE_VERSION 4#define LLVM_PROFILE_NUM_KINDS 2 -#else -#error "clang version not supported with coverage" -#endif Rant: most of the LLVM coverage stuff is already kind of dead code, as the format of the data changes between versions and there's no way for LLVM to generate the blob itself using a builtin function or similar. We haven't kept up with new formats, and now it's not possible to parse the output coverage data when using newish LLVM versions.
Quoted 5 lines
Linux converts it's LLVM coverage data to gcov format (which AFAIK is way more stable), and exports it in gcov format. We should consider importing that from Linux.
Thanks, Roger.
Fair point. Generally I found coverage reports generated using LLVM tooling a bit more informative than gcov's, but I don't know how much work would it be to adapt Xen for newer versions of LLVM.
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 48 lines · Nicola Vetrini
Quoted 47 lines · Roger Pau Monné
Quoted 8 lines · On Sun, Aug 10, 2025 at 03:03:53PM +0200, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Acked-by Roger Pau Monné <[email protected]>Quoted 12 lines
---
Mentioned in https://gitlab.com/xen-project/xen/-/issues/201--- xen/common/coverage/llvm.c | 4 ---- xen/include/xen/self-tests.h | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-)xen/common/coverage/llvm.c +0
-0xen/common/coverage/llvm.c line 53
Quoted 10 lines
xen/common/coverage/llvm.c +0
-4@@ -44,12 +44,8 @@ ((uint64_t)'f' << 16) | ((uint64_t)'R' << 8) | ((uint64_t)129)#endif -#if __clang_major__ >=4 || (__clang_major__ ==3 && __clang_minor__ >= 9)#define LLVM_PROFILE_VERSION 4#define LLVM_PROFILE_NUM_KINDS 2 -#else -#error "clang version not supported with coverage" -#endif Rant: most of the LLVM coverage stuff is already kind of dead code, as the format of the data changes between versions and there's no way for LLVM to generate the blob itself using a builtin function or similar. We haven't kept up with new formats, and now it's not possible to parse the output coverage data when using newish LLVM versions.
Linux converts it's LLVM coverage data to gcov format (which AFAIK is way more stable), and exports it in gcov format. We should consider importing that from Linux.
Quoted 5 lines
Quoted 1 line
Thanks, Roger.
Fair point. Generally I found coverage reports generated using LLVM tooling a bit more informative than gcov's, but I don't know how much work would it be to adapt Xen for newer versions of LLVM.
It's a pain because they keep changing the blob format between versions, so we would basically need code in Xen to be able to generate the right blob for each possible clang version.
It would be helpful if clang provided the helpers to generate the coverage data in a version agnostic way, but so far I haven't found a way to do it. I've raised a question with upstream LLVM project, but no replies:
https://github.com/llvm/llvm-project/issues/123034
Regards, Roger.
Quoted 59 lines · Roger Pau Monné
Quoted 48 lines · Nicola Vetrini
Quoted 47 lines · Roger Pau Monné
Quoted 8 lines · On Sun, Aug 10, 2025 at 03:03:53PM +0200, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Acked-by Roger Pau Monné <[email protected]>Quoted 12 lines
---
Mentioned in https://gitlab.com/xen-project/xen/-/issues/201--- xen/common/coverage/llvm.c | 4 ---- xen/include/xen/self-tests.h | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-)xen/common/coverage/llvm.c +0
-0xen/common/coverage/llvm.c line 53
Quoted 10 lines
xen/common/coverage/llvm.c +0
-4@@ -44,12 +44,8 @@ ((uint64_t)'f' << 16) | ((uint64_t)'R' << 8) | ((uint64_t)129)#endif -#if __clang_major__ >=4 || (__clang_major__ ==3 && __clang_minor__ >= 9)#define LLVM_PROFILE_VERSION 4#define LLVM_PROFILE_NUM_KINDS 2 -#else -#error "clang version not supported with coverage" -#endif Rant: most of the LLVM coverage stuff is already kind of dead code, as the format of the data changes between versions and there's no way for LLVM to generate the blob itself using a builtin function or similar. We haven't kept up with new formats, and now it's not possible to parse the output coverage data when using newish LLVM versions.
Linux converts it's LLVM coverage data to gcov format (which AFAIK is way more stable), and exports it in gcov format. We should consider importing that from Linux.
Quoted 5 lines
Quoted 1 line
Thanks, Roger.
Fair point. Generally I found coverage reports generated using LLVM tooling a bit more informative than gcov's, but I don't know how much work would it be to adapt Xen for newer versions of LLVM.
It's a pain because they keep changing the blob format between versions, so we would basically need code in Xen to be able to generate the right blob for each possible clang version.
Quoted 8 lines
It would be helpful if clang provided the helpers to generate the coverage data in a version agnostic way, but so far I haven't found a way to do it. I've raised a question with upstream LLVM project, but no replies:
https://github.com/llvm/llvm-project/issues/123034
Regards, Roger.
Perhaps the "coverage" and "llvm-cov" tag might help get more traction; there is at least one developer working on the source-based code coverage area in the past months with various improvements.
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 8 lines · On 10/08/2025 2:03 pm, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>
Thanks for the patch, but your From and SoB lines don't match. Which is it supposed to be?
~Andrew
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · On 10/08/2025 2:03 pm, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
Quoted 8 lines
Quoted 3 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Thanks for the patch, but your From and SoB lines don't match. Which is it supposed to be?
~Andrew
The gmail one, git misconfiguration, sorry. Should I resend?
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 9 lines · Nicola Vetrini
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · On 10/08/2025 2:03 pm, [email protected] wrote:
From: Nicola Vetrini <[email protected]>
The enforced toolchain baseline for clang is version 11, therefore this logic is effectively dead code.
No functional change.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Nicola Vetrini <[email protected]>Thanks for the patch, but your From and SoB lines don't match. Which is it supposed to be?
~Andrew
The gmail one, git misconfiguration, sorry. Should I resend?
No need. I can fix up on commit. Thanks.
~Andrew