Skip to contentSkip to conversation

objtool: fix failure when being compiled on x32 system

PATCH Ard Biesheuvel 3 participants 3 messages Oct 14, 2025 – Oct 20, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ard Biesheuvel

author Acked-by
#1 lore raw

(cc lkml)

Quoted 31 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’

 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(-)

Index: linux-2.6/tools/objtool/check.c
===================================================================

tools/objtool/check.c 2025-10-13 21:48:33.000000000 +0200 static int check_abs_references(struct o · line 4717

Quoted 10 lines
tools/objtool/check.c 2025-10-13 21:48:33.000000000 +0200 renamed from tools/objtool/check.c 2025-10-13 21:42:48.000000000 +0200 +2 -2
@@ -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++;
                        }
                }
#2 lore raw
Quoted 1 line · Ard Biesheuvel

(cc lkml)

Can you resend the patch and copy lkml?

Quoted 44 lines · Mikulas Patocka
Quoted 31 lines

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(-)

Index: linux-2.6/tools/objtool/check.c
===================================================================

tools/objtool/check.c 2025-10-13 21:48:33.000000000 +0200 static int check_abs_references(struct o · line 4717

Quoted 10 lines
tools/objtool/check.c 2025-10-13 21:48:33.000000000 +0200 renamed from tools/objtool/check.c 2025-10-13 21:42:48.000000000 +0200 +2 -2
@@ -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++;
                        }
                }
Signature · 1 line
Josh
#3 lore raw
Quoted 4 lines · Josh Poimboeuf
Quoted 1 line · Ard Biesheuvel

(cc lkml)

Can you resend the patch and copy lkml?

OK, I've resent it.

Mikulas