Skip to contentSkip to conversation

objtool: Add missing endian conversion to read_annotate()

PATCH Applied Heiko Carstens 3 participants 3 messages Jun 30, 2025 – Jul 1, 2025 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: Add missing endian conversion to read_annotate()

Trying to compile an x86 kernel on big endian results in this error:

net/ipv4/netfilter/iptable_nat.o: warning: objtool: iptable_nat_table_init+0x150: Unknown annotation type: 50331648 make[5]: *** [scripts/Makefile.build:287: net/ipv4/netfilter/iptable_nat.o] Error 255

Reason is a missing endian conversion in read_annotate(). Add the missing conversion to fix this.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)
tools/objtool/check.c +1 -0
index f23bdda737aa..d967ac001498 100644
@@ -2318,6 +2318,7 @@ static int read_annotate(struct objtool_file *file,
 
 	for_each_reloc(sec->rsec, reloc) {
 		type = *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4);
+		type = bswap_if_needed(file->elf, type);
 
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);
Signature · 1 line
2.48.1
maintainer
#1 lore raw
Quoted 10 lines · Heiko Carstens

Trying to compile an x86 kernel on big endian results in this error:

net/ipv4/netfilter/iptable_nat.o: warning: objtool: iptable_nat_table_init+0x150: Unknown annotation type: 50331648 make[5]: *** [scripts/Makefile.build:287: net/ipv4/netfilter/iptable_nat.o] Error 255

Reason is a missing endian conversion in read_annotate(). Add the missing conversion to fix this.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")

Thanks!

merge bot Applied
#2 lore raw
In reply to Heiko Carstens
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:     ccdd09e0fc0d5ce6dfc8360f0c88da9a5045b6ea
Gitweb:        https://git.kernel.org/tip/ccdd09e0fc0d5ce6dfc8360f0c88da9a5045b6ea
Author:        Heiko Carstens <[email protected]>
AuthorDate:    Mon, 30 Jun 2025 15:12:30 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 01 Jul 2025 15:02:04 +02:00

objtool: Add missing endian conversion to read_annotate()

Trying to compile an x86 kernel on big endian results in this error:

net/ipv4/netfilter/iptable_nat.o: warning: objtool: iptable_nat_table_init+0x150: Unknown annotation type: 50331648 make[5]: *** [scripts/Makefile.build:287: net/ipv4/netfilter/iptable_nat.o] Error 255

Reason is a missing endian conversion in read_annotate(). Add the missing conversion to fix this.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)
tools/objtool/check.c +1 -0
index f23bdda..d967ac0 100644
@@ -2318,6 +2318,7 @@ static int read_annotate(struct objtool_file *file,
 
 	for_each_reloc(sec->rsec, reloc) {
 		type = *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4);
+		type = bswap_if_needed(file->elf, type);
 
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);