Merge tag 'kbuild-fixes-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

- Move warnings about linux/export.h from W=1 to W=2

- Fix structure type overrides in gendwarfksyms

* tag 'kbuild-fixes-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
gendwarfksyms: Fix structure type overrides
kbuild: move warnings about linux/export.h from W=1 to W=2

Changed files
+33 -64
scripts
-3
Makefile
··· 1832 1832 # Misc 1833 1833 # --------------------------------------------------------------------------- 1834 1834 1835 - # Run misc checks when ${KBUILD_EXTRA_WARN} contains 1 1836 1835 PHONY += misc-check 1837 - ifneq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) 1838 1836 misc-check: 1839 1837 $(Q)$(srctree)/scripts/misc-check 1840 - endif 1841 1838 1842 1839 all: misc-check 1843 1840
+2 -12
scripts/gendwarfksyms/gendwarfksyms.h
··· 216 216 void cache_init(struct cache *cache); 217 217 void cache_free(struct cache *cache); 218 218 219 - static inline void __cache_mark_expanded(struct cache *cache, uintptr_t addr) 220 - { 221 - cache_set(cache, addr, 1); 222 - } 223 - 224 - static inline bool __cache_was_expanded(struct cache *cache, uintptr_t addr) 225 - { 226 - return cache_get(cache, addr) == 1; 227 - } 228 - 229 219 static inline void cache_mark_expanded(struct cache *cache, void *addr) 230 220 { 231 - __cache_mark_expanded(cache, (uintptr_t)addr); 221 + cache_set(cache, (unsigned long)addr, 1); 232 222 } 233 223 234 224 static inline bool cache_was_expanded(struct cache *cache, void *addr) 235 225 { 236 - return __cache_was_expanded(cache, (uintptr_t)addr); 226 + return cache_get(cache, (unsigned long)addr) == 1; 237 227 } 238 228 239 229 /*
+19 -46
scripts/gendwarfksyms/types.c
··· 333 333 cache_free(&expansion_cache); 334 334 } 335 335 336 - static void __type_expand(struct die *cache, struct type_expansion *type, 337 - bool recursive); 338 - 339 - static void type_expand_child(struct die *cache, struct type_expansion *type, 340 - bool recursive) 341 - { 342 - struct type_expansion child; 343 - char *name; 344 - 345 - name = get_type_name(cache); 346 - if (!name) { 347 - __type_expand(cache, type, recursive); 348 - return; 349 - } 350 - 351 - if (recursive && !__cache_was_expanded(&expansion_cache, cache->addr)) { 352 - __cache_mark_expanded(&expansion_cache, cache->addr); 353 - type_expansion_init(&child); 354 - __type_expand(cache, &child, true); 355 - type_map_add(name, &child); 356 - type_expansion_free(&child); 357 - } 358 - 359 - type_expansion_append(type, name, name); 360 - } 361 - 362 - static void __type_expand(struct die *cache, struct type_expansion *type, 363 - bool recursive) 336 + static void __type_expand(struct die *cache, struct type_expansion *type) 364 337 { 365 338 struct die_fragment *df; 366 339 struct die *child; 340 + char *name; 367 341 368 342 list_for_each_entry(df, &cache->fragments, list) { 369 343 switch (df->type) { ··· 353 379 error("unknown child: %" PRIxPTR, 354 380 df->data.addr); 355 381 356 - type_expand_child(child, type, recursive); 382 + name = get_type_name(child); 383 + if (name) 384 + type_expansion_append(type, name, name); 385 + else 386 + __type_expand(child, type); 387 + 357 388 break; 358 389 case FRAGMENT_LINEBREAK: 359 390 /* ··· 376 397 } 377 398 } 378 399 379 - static void type_expand(struct die *cache, struct type_expansion *type, 380 - bool recursive) 400 + static void type_expand(const char *name, struct die *cache, 401 + struct type_expansion *type) 381 402 { 403 + const char *override; 404 + 382 405 type_expansion_init(type); 383 - __type_expand(cache, type, recursive); 384 - cache_free(&expansion_cache); 406 + 407 + if (stable && kabi_get_type_string(name, &override)) 408 + type_parse(name, override, type); 409 + else 410 + __type_expand(cache, type); 385 411 } 386 412 387 413 static void type_parse(const char *name, const char *str, ··· 399 415 400 416 if (!*str) 401 417 error("empty type string override for '%s'", name); 402 - 403 - type_expansion_init(type); 404 418 405 419 for (pos = 0; str[pos]; ++pos) { 406 420 bool empty; ··· 460 478 static void expand_type(struct die *cache, void *arg) 461 479 { 462 480 struct type_expansion type; 463 - const char *override; 464 481 char *name; 465 482 466 483 if (cache->mapped) ··· 485 504 486 505 debug("%s", name); 487 506 488 - if (stable && kabi_get_type_string(name, &override)) 489 - type_parse(name, override, &type); 490 - else 491 - type_expand(cache, &type, true); 492 - 507 + type_expand(name, cache, &type); 493 508 type_map_add(name, &type); 494 509 type_expansion_free(&type); 495 510 free(name); ··· 495 518 { 496 519 struct type_expansion type; 497 520 struct version version; 498 - const char *override; 499 521 struct die *cache; 500 522 501 523 /* ··· 508 532 if (__die_map_get(sym->die_addr, DIE_SYMBOL, &cache)) 509 533 return; /* We'll warn about missing CRCs later. */ 510 534 511 - if (stable && kabi_get_type_string(sym->name, &override)) 512 - type_parse(sym->name, override, &type); 513 - else 514 - type_expand(cache, &type, false); 535 + type_expand(sym->name, cache, &type); 515 536 516 537 /* If the symbol already has a version, don't calculate it again. */ 517 538 if (sym->state != SYMBOL_PROCESSED) {
+12 -3
scripts/misc-check
··· 62 62 xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present\n" >&2 63 63 } 64 64 65 - check_tracked_ignored_files 66 - check_missing_include_linux_export_h 67 - check_unnecessary_include_linux_export_h 65 + case "${KBUILD_EXTRA_WARN}" in 66 + *1*) 67 + check_tracked_ignored_files 68 + ;; 69 + esac 70 + 71 + case "${KBUILD_EXTRA_WARN}" in 72 + *2*) 73 + check_missing_include_linux_export_h 74 + check_unnecessary_include_linux_export_h 75 + ;; 76 + esac