Skip to content

Commit 08215f5

Browse files
committed
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
2 parents 8c6bc74 + 2f6b47b commit 08215f5

File tree

4 files changed

+33
-64
lines changed

4 files changed

+33
-64
lines changed

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,12 +1832,9 @@ rustfmtcheck: rustfmt
18321832
# Misc
18331833
# ---------------------------------------------------------------------------
18341834

1835-
# Run misc checks when ${KBUILD_EXTRA_WARN} contains 1
18361835
PHONY += misc-check
1837-
ifneq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
18381836
misc-check:
18391837
$(Q)$(srctree)/scripts/misc-check
1840-
endif
18411838

18421839
all: misc-check
18431840

scripts/gendwarfksyms/gendwarfksyms.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,24 +216,14 @@ int cache_get(struct cache *cache, unsigned long key);
216216
void cache_init(struct cache *cache);
217217
void cache_free(struct cache *cache);
218218

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-
229219
static inline void cache_mark_expanded(struct cache *cache, void *addr)
230220
{
231-
__cache_mark_expanded(cache, (uintptr_t)addr);
221+
cache_set(cache, (unsigned long)addr, 1);
232222
}
233223

234224
static inline bool cache_was_expanded(struct cache *cache, void *addr)
235225
{
236-
return __cache_was_expanded(cache, (uintptr_t)addr);
226+
return cache_get(cache, (unsigned long)addr) == 1;
237227
}
238228

239229
/*

scripts/gendwarfksyms/types.c

Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -333,37 +333,11 @@ static void calculate_version(struct version *version,
333333
cache_free(&expansion_cache);
334334
}
335335

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)
364337
{
365338
struct die_fragment *df;
366339
struct die *child;
340+
char *name;
367341

368342
list_for_each_entry(df, &cache->fragments, list) {
369343
switch (df->type) {
@@ -379,7 +353,12 @@ static void __type_expand(struct die *cache, struct type_expansion *type,
379353
error("unknown child: %" PRIxPTR,
380354
df->data.addr);
381355

382-
type_expand_child(child, type, recursive);
356+
name = get_type_name(child);
357+
if (name)
358+
type_expansion_append(type, name, name);
359+
else
360+
__type_expand(child, type);
361+
383362
break;
384363
case FRAGMENT_LINEBREAK:
385364
/*
@@ -397,12 +376,17 @@ static void __type_expand(struct die *cache, struct type_expansion *type,
397376
}
398377
}
399378

400-
static void type_expand(struct die *cache, struct type_expansion *type,
401-
bool recursive)
379+
static void type_expand(const char *name, struct die *cache,
380+
struct type_expansion *type)
402381
{
382+
const char *override;
383+
403384
type_expansion_init(type);
404-
__type_expand(cache, type, recursive);
405-
cache_free(&expansion_cache);
385+
386+
if (stable && kabi_get_type_string(name, &override))
387+
type_parse(name, override, type);
388+
else
389+
__type_expand(cache, type);
406390
}
407391

408392
static void type_parse(const char *name, const char *str,
@@ -416,8 +400,6 @@ static void type_parse(const char *name, const char *str,
416400
if (!*str)
417401
error("empty type string override for '%s'", name);
418402

419-
type_expansion_init(type);
420-
421403
for (pos = 0; str[pos]; ++pos) {
422404
bool empty;
423405
char marker = ' ';
@@ -478,7 +460,6 @@ static void type_parse(const char *name, const char *str,
478460
static void expand_type(struct die *cache, void *arg)
479461
{
480462
struct type_expansion type;
481-
const char *override;
482463
char *name;
483464

484465
if (cache->mapped)
@@ -504,11 +485,7 @@ static void expand_type(struct die *cache, void *arg)
504485

505486
debug("%s", name);
506487

507-
if (stable && kabi_get_type_string(name, &override))
508-
type_parse(name, override, &type);
509-
else
510-
type_expand(cache, &type, true);
511-
488+
type_expand(name, cache, &type);
512489
type_map_add(name, &type);
513490
type_expansion_free(&type);
514491
free(name);
@@ -518,7 +495,6 @@ static void expand_symbol(struct symbol *sym, void *arg)
518495
{
519496
struct type_expansion type;
520497
struct version version;
521-
const char *override;
522498
struct die *cache;
523499

524500
/*
@@ -532,10 +508,7 @@ static void expand_symbol(struct symbol *sym, void *arg)
532508
if (__die_map_get(sym->die_addr, DIE_SYMBOL, &cache))
533509
return; /* We'll warn about missing CRCs later. */
534510

535-
if (stable && kabi_get_type_string(sym->name, &override))
536-
type_parse(sym->name, override, &type);
537-
else
538-
type_expand(cache, &type, false);
511+
type_expand(sym->name, cache, &type);
539512

540513
/* If the symbol already has a version, don't calculate it again. */
541514
if (sym->state != SYMBOL_PROCESSED) {

scripts/misc-check

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ check_unnecessary_include_linux_export_h () {
6262
xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present\n" >&2
6363
}
6464

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

0 commit comments

Comments
 (0)