[Skiboot] [PATCH 3/5] extract-gcov: Add counters for GCC > 7

Reza Arbab arbab at linux.ibm.com
Sat Mar 15 04:25:13 AEDT 2025


The number of gcov counters can be derived from the gcc source by doing

  git grep -c ^DEF_GCOV_COUNTER $(git tag | grep ^releases/gcc) gcc/gcov-counter.def

Add the newer GCC releases to extract-gcov. While we're at it, rewrite
the preprocessor statements to use #elif for easier reading.

Signed-off-by: Reza Arbab <arbab at linux.ibm.com>
---
 extract-gcov.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/extract-gcov.c b/extract-gcov.c
index f1dec35946e5..c48cd6fbd0a1 100644
--- a/extract-gcov.c
+++ b/extract-gcov.c
@@ -20,19 +20,19 @@
 typedef u32 gcov_unsigned_int;
 
 /* You will need to pass -DTARGET__GNUC__=blah when building */
-#if (__GNUC__ >= 7)
-#define GCOV_COUNTERS                   9
+#if TARGET__GNUC__ >= 14
+#define GCOV_COUNTERS 9
+#elif TARGET__GNUC__ >= 10
+#define GCOV_COUNTERS 8
+#elif TARGET__GNUC__ >= 7
+#define GCOV_COUNTERS 9
+#elif TARGET__GNUC__ >= 5
+#define GCOV_COUNTERS 10
+#elif TARGET__GNUC__ >= 4 && TARGET__GNUC_MINOR__ >= 9
+#define GCOV_COUNTERS 9
 #else
-#if TARGET__GNUC__ >= 6 || (TARGET__GNUC__ >= 5 && TARGET__GNUC_MINOR__ >= 1)
-#define GCOV_COUNTERS                   10
-#else
-#if TARGET__GNUC__ >= 4 && TARGET__GNUC_MINOR__ >= 9
-#define GCOV_COUNTERS                   9
-#else
-#define GCOV_COUNTERS                   8
-#endif /* GCC 4.9 */
-#endif /* GCC 5.1 */
-#endif /* GCC 7 */
+#define GCOV_COUNTERS 8
+#endif
 typedef u64 gcov_type;
 
 struct gcov_info
-- 
2.43.5



More information about the Skiboot mailing list