History

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.

Sami Tolvanen committed 12 months ago

Commit ddc54f91 parent d7afd652 files · +6 −3Browse files

Showing the changes to scripts (2 of 2 files). Show all

Unified · Split

2 files
  1. scripts/gendwarfksyms/dwarf.c +3 −1
  2. scripts/gendwarfksyms/symbols.c +3 −2
scripts/gendwarfksyms/dwarf.c+3−1
@@ -750,6 +750,7 @@ static void process_enumerator_type(struct state *state, struct die *cache, · 749 unmodified lines
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, · 5 unmodified lines
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+3−2
@@ -3,6 +3,7 @@ · 2 unmodified lines
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) · 233 unmodified lines
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) · 43 unmodified lines
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) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t