Skip to contentSkip to conversation

objtool: fix compilation failure with the x32 toolchain

PATCH Applied Mikulas Patocka 3 participants 3 messages Jan 6 – Jan 13 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: fix compilation failure with the x32 toolchain

When using the x32 toolchain, compilation fails because the printf specifier "%lx" (long), doesn't match the type of the "checksum" variable (long long). Fix this by changing the printf specifier to "%llx" and casting "checksum" to unsigned long long.

Fixes a3493b33384a ("objtool/klp: Add --debug-checksum=<funcs> to show per-instruction checksums")
---
 tools/objtool/include/objtool/warn.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/objtool/include/objtool/warn.h +2 -2
Index: linux-2.6/tools/objtool/include/objtool/warn.h
===================================================================
@@ -152,8 +152,8 @@ static inline void unindent(int *unused)
 	if (unlikely(insn->sym && insn->sym->pfunc &&			\
 		     insn->sym->pfunc->debug_checksum)) {		\
 		char *insn_off = offstr(insn->sec, insn->offset);	\
-		__dbg("checksum: %s %s %016lx",				\
-		      func->name, insn_off, checksum);			\
+		__dbg("checksum: %s %s %016llx",			\
+		      func->name, insn_off, (unsigned long long)checksum);\
 		free(insn_off);						\
 	}								\
 })
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Mikulas Patocka

When using the x32 toolchain, compilation fails because the printf specifier "%lx" (long), doesn't match the type of the "checksum" variable (long long). Fix this by changing the printf specifier to "%llx" and casting "checksum" to unsigned long long.

Fixes a3493b33384a ("objtool/klp: Add --debug-checksum=<funcs> to show per-instruction checksums")
---
 tools/objtool/include/objtool/warn.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/tools/objtool/include/objtool/warn.h
===================================================================

tools/objtool/include/objtool/warn.h static inline void unindent(int *unused) · line 159

Quoted 10 lines
tools/objtool/include/objtool/warn.h +2 -2
@@ -152,8 +152,8 @@ static inline void unindent(int *unused)
 	if (unlikely(insn->sym && insn->sym->pfunc &&			\
 		     insn->sym->pfunc->debug_checksum)) {		\
 		char *insn_off = offstr(insn->sec, insn->offset);	\
-		__dbg("checksum: %s %s %016lx",				\
-		      func->name, insn_off, checksum);			\
+		__dbg("checksum: %s %s %016llx",			\
+		      func->name, insn_off, (unsigned long long)checksum);\
 		free(insn_off);						\
 	}								\
 })

--
Joe

#2 lore raw
In reply to Mikulas Patocka
The following commit has been merged into the objtool/urgent branch of tip:

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     26bea10450afe5ad4dd0e0bbb797c44e1df110fe
Gitweb:        https://git.kernel.org/tip/26bea10450afe5ad4dd0e0bbb797c44e1df110fe
Author:        Mikulas Patocka <[email protected]>
AuthorDate:    Tue, 06 Jan 2026 12:13:15 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 13 Jan 2026 11:37:50 +01:00

objtool: fix compilation failure with the x32 toolchain

When using the x32 toolchain, compilation fails because the printf specifier "%lx" (long), doesn't match the type of the "checksum" variable (long long). Fix this by changing the printf specifier to "%llx" and casting "checksum" to unsigned long long.

Fixes a3493b33384a ("objtool/klp: Add --debug-checksum=<funcs> to show per-instruction checksums")
---
 tools/objtool/include/objtool/warn.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/objtool/include/objtool/warn.h +2 -2
index 25ff794..2b27b54 100644
@@ -152,8 +152,8 @@ static inline void unindent(int *unused) { indent--; }
 	if (unlikely(insn->sym && insn->sym->pfunc &&			\
 		     insn->sym->pfunc->debug_checksum)) {		\
 		char *insn_off = offstr(insn->sec, insn->offset);	\
-		__dbg("checksum: %s %s %016lx",				\
-		      func->name, insn_off, checksum);			\
+		__dbg("checksum: %s %s %016llx",			\
+		      func->name, insn_off, (unsigned long long)checksum);\
 		free(insn_off);						\
 	}								\
 })