Skip to contentSkip to conversation

gendwarfksyms: Fix structure type overrides

PATCH New Sami Tolvanen 1 participant 1 message Jun 14, 2025

Subsystems (2)
lore
Share & tools
lore

Sami Tolvanen

author maintainer
#0 lore raw

PATCH v2 1/1 gendwarfksyms: Fix structure type overrides

As we always iterate through the entire die_map when expanding type strings, recursively processing referenced types in type_expand_child() is not actually necessary. Furthermore, the type_string kABI rule added in commit c9083467f7b9 ("gendwarfksyms: Add a kABI rule to override type strings") can fail to override type strings for structures due to a missing kabi_get_type_string() check in this function.

Fix the issue by dropping the unnecessary recursion and moving the override check to type_expand(). Note that symbol versions are otherwise unchanged with this patch.

Fixes c9083467f7b9 ("gendwarfksyms: Add a kABI rule to override type strings")

---
v2:
- Dropped the now unused __cache_*_expanded() functions per Petr's suggestion.

v1: https://lore.kernel.org/r/[email protected]/

 scripts/gendwarfksyms/gendwarfksyms.h | 14 +-----
 scripts/gendwarfksyms/types.c         | 65 ++++++++-------------------
 2 files changed, 21 insertions(+), 58 deletions(-)
scripts/gendwarfksyms/gendwarfksyms.h +2 -12
index 7dd03ffe0c5c..d9c06d2cb1df 100644
@@ -216,24 +216,14 @@ int cache_get(struct cache *cache, unsigned long key);
 void cache_init(struct cache *cache);
 void cache_free(struct cache *cache);
 
-static inline void __cache_mark_expanded(struct cache *cache, uintptr_t addr)
-{
-	cache_set(cache, addr, 1);
-}
-
-static inline bool __cache_was_expanded(struct cache *cache, uintptr_t addr)
-{
-	return cache_get(cache, addr) == 1;
-}
-
 static inline void cache_mark_expanded(struct cache *cache, void *addr)
 {
-	__cache_mark_expanded(cache, (uintptr_t)addr);
+	cache_set(cache, (unsigned long)addr, 1);
 }
 
 static inline bool cache_was_expanded(struct cache *cache, void *addr)
 {
-	return __cache_was_expanded(cache, (uintptr_t)addr);
+	return cache_get(cache, (unsigned long)addr) == 1;
 }
 
 /*
scripts/gendwarfksyms/types.c +19 -46

118 lines not on this page · raw message

base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494

Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog