Skip to contentSkip to conversation

objtool: fix failure when being compiled on x32 system

PATCH Applied Mikulas Patocka 3 participants 3 messages Oct 20, 2025 – Oct 22, 2025 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: fix failure when being compiled on x32 system

Fix compilation failure when compiling the kernel with the x32 toolchain.

In file included from check.c:16:
check.c: In function ‘check_abs_references’:
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:47:17: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror=format=]

   47 |                 "%s%s%s: objtool" extra ": " format "\n",               \
      |                 ^~~~~~~~~~~~~~~~~
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:54:9: note: in expansion of macro ‘___WARN’
   54 |         ___WARN(severity, "", format, ##__VA_ARGS__)
      |         ^~~~~~~

/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:74:27: note: in expansion of macro ‘__WARN’
74 | #define WARN(format, ...) __WARN(WARN_STR, format, ##__VA_ARGS__)
| ^~~~~~
check.c:4713:33: note: in expansion of macro ‘WARN’

 4713 |                                 WARN("section %s has absolute relocation at offset 0x%lx",
      |                                 ^~~~
Fixes 0d6e4563fc03 ("objtool: Add action to check for absence of absolute relocations")
---
 tools/objtool/check.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/objtool/check.c +2 -2
Index: linux-2.6/tools/objtool/check.c
===================================================================
@@ -4710,8 +4710,8 @@ static int check_abs_references(struct o
 
 		for_each_reloc(sec->rsec, reloc) {
 			if (arch_absolute_reloc(file->elf, reloc)) {
-				WARN("section %s has absolute relocation at offset 0x%lx",
-				     sec->name, reloc_offset(reloc));
+				WARN("section %s has absolute relocation at offset 0x%llx",
+				     sec->name, (unsigned long long)reloc_offset(reloc));
 				ret++;
 			}
 		}
maintainer
#1 lore raw
Quoted 15 lines · Mikulas Patocka

Fix compilation failure when compiling the kernel with the x32 toolchain.

In file included from check.c:16:
check.c: In function ‘check_abs_references’:
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:47:17: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror=format=]

   47 |                 "%s%s%s: objtool" extra ": " format "\n",               \
      |                 ^~~~~~~~~~~~~~~~~
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:54:9: note: in expansion of macro ‘___WARN’
   54 |         ___WARN(severity, "", format, ##__VA_ARGS__)
      |         ^~~~~~~

/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:74:27: note: in expansion of macro ‘__WARN’
74 | #define WARN(format, ...) __WARN(WARN_STR, format, ##__VA_ARGS__)
| ^~~~~~
check.c:4713:33: note: in expansion of macro ‘WARN’

Quoted 5 lines
 4713 |                                 WARN("section %s has absolute relocation at offset 0x%lx",
      |                                 ^~~~
Fixes 0d6e4563fc03 ("objtool: Add action to check for absence of absolute relocations")

You could've kept Ard's Ack. I'll go add it manually.

Thanks!

#2 lore raw

[tip: objtool/urgent] objtool: Fix failure when being compiled on x32 system

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:     49c98f30f4021b560676a336f8a46a4f642eee2b
Gitweb:        https://git.kernel.org/tip/49c98f30f4021b560676a336f8a46a4f642eee2b
Author:        Mikulas Patocka <[email protected]>
AuthorDate:    Mon, 20 Oct 2025 14:23:58 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 22 Oct 2025 15:21:55 +02:00

objtool: Fix failure when being compiled on x32 system

Fix compilation failure when compiling the kernel with the x32 toolchain.

In file included from check.c:16:
check.c: In function ¡check_abs_references¢:
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:47:17: error: format ¡%lx¢ expects argument of type ¡long unsigned int¢, but argument 7 has type ¡u64¢ {aka ¡long long unsigned int¢} [-Werror=format=]

   47 |                 "%s%s%s: objtool" extra ": " format "\n",               \
      |                 ^~~~~~~~~~~~~~~~~
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:54:9: note: in expansion of macro ¡___WARN¢
   54 |         ___WARN(severity, "", format, ##__VA_ARGS__)
      |         ^~~~~~~

/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:74:27: note: in expansion of macro ¡__WARN¢
74 | #define WARN(format, ...) __WARN(WARN_STR, format, ##__VA_ARGS__)
| ^~~~~~
check.c:4713:33: note: in expansion of macro ¡WARN¢

 4713 |                                 WARN("section %s has absolute relocation at offset 0x%lx",
      |                                 ^~~~
Fixes 0d6e4563fc03 ("objtool: Add action to check for absence of absolute relocations")
---
 tools/objtool/check.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/objtool/check.c +2 -2
index 3c7ab91..620854f 100644
@@ -4711,8 +4711,8 @@ static int check_abs_references(struct objtool_file *file)
 
 		for_each_reloc(sec->rsec, reloc) {
 			if (arch_absolute_reloc(file->elf, reloc)) {
-				WARN("section %s has absolute relocation at offset 0x%lx",
-				     sec->name, reloc_offset(reloc));
+				WARN("section %s has absolute relocation at offset 0x%llx",
+				     sec->name, (unsigned long long)reloc_offset(reloc));
 				ret++;
 			}
 		}