Skip to content

Commit ddc54f9

Browse files
committed
gendwarfksyms: Fix build on 32-bit hosts
We have interchangeably used unsigned long for some of the types defined in elfutils, assuming they're always 64-bit. This obviously fails when building gendwarfksyms on 32-bit hosts. Fix the types. Reported-by: Michal Suchánek <msuchanek@suse.de> Closes: https://lore.kernel.org/linux-modules/aRcxzPxtJblVSh1y@kitsune.suse.cz/ Tested-by: Michal Suchánek <msuchanek@suse.de> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
1 parent d7afd65 commit ddc54f9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/gendwarfksyms/dwarf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ static void process_enumerator_type(struct state *state, struct die *cache,
750750
Dwarf_Die *die)
751751
{
752752
bool overridden = false;
753+
unsigned long override;
753754
Dwarf_Word value;
754755

755756
if (stable) {
@@ -761,7 +762,8 @@ static void process_enumerator_type(struct state *state, struct die *cache,
761762
return;
762763

763764
overridden = kabi_get_enumerator_value(
764-
state->expand.current_fqn, cache->fqn, &value);
765+
state->expand.current_fqn, cache->fqn, &override);
766+
value = override;
765767
}
766768

767769
process_list_comma(state, cache);

scripts/gendwarfksyms/symbols.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2024 Google LLC
44
*/
55

6+
#include <inttypes.h>
67
#include "gendwarfksyms.h"
78

89
#define SYMBOL_HASH_BITS 12
@@ -242,7 +243,7 @@ static void elf_for_each_global(int fd, elf_symbol_callback_t func, void *arg)
242243
error("elf_getdata failed: %s", elf_errmsg(-1));
243244

244245
if (shdr->sh_entsize != sym_size)
245-
error("expected sh_entsize (%lu) to be %zu",
246+
error("expected sh_entsize (%" PRIu64 ") to be %zu",
246247
shdr->sh_entsize, sym_size);
247248

248249
nsyms = shdr->sh_size / shdr->sh_entsize;
@@ -292,7 +293,7 @@ static void set_symbol_addr(struct symbol *sym, void *arg)
292293
hash_add(symbol_addrs, &sym->addr_hash,
293294
symbol_addr_hash(&sym->addr));
294295

295-
debug("%s -> { %u, %lx }", sym->name, sym->addr.section,
296+
debug("%s -> { %u, %" PRIx64 " }", sym->name, sym->addr.section,
296297
sym->addr.address);
297298
} else if (sym->addr.section != addr->section ||
298299
sym->addr.address != addr->address) {

0 commit comments

Comments
 (0)