mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] objtool: Add missing endian conversion to read_annotate()
@ 2025-06-30 13:12 Heiko Carstens
  2025-06-30 13:22 ` Peter Zijlstra
  2025-07-01 13:13 ` [tip: objtool/urgent] " tip-bot2 for Heiko Carstens
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko Carstens @ 2025-06-30 13:12 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel

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")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index f23bdda737aa..d967ac001498 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -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);
-- 
2.48.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] objtool: Add missing endian conversion to read_annotate()
  2025-06-30 13:12 [PATCH] objtool: Add missing endian conversion to read_annotate() Heiko Carstens
@ 2025-06-30 13:22 ` Peter Zijlstra
  2025-07-01 13:13 ` [tip: objtool/urgent] " tip-bot2 for Heiko Carstens
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2025-06-30 13:22 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Josh Poimboeuf, linux-kernel

On Mon, Jun 30, 2025 at 03:12:30PM +0200, Heiko Carstens wrote:
> 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")
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: objtool/urgent] objtool: Add missing endian conversion to read_annotate()
  2025-06-30 13:12 [PATCH] objtool: Add missing endian conversion to read_annotate() Heiko Carstens
  2025-06-30 13:22 ` Peter Zijlstra
@ 2025-07-01 13:13 ` tip-bot2 for Heiko Carstens
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Heiko Carstens @ 2025-07-01 13:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Heiko Carstens, Peter Zijlstra (Intel), x86, linux-kernel

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 <hca@linux.ibm.com>
AuthorDate:    Mon, 30 Jun 2025 15:12:30 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250630131230.4130185-1-hca@linux.ibm.com
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index f23bdda..d967ac0 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-01 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 13:12 [PATCH] objtool: Add missing endian conversion to read_annotate() Heiko Carstens
2025-06-30 13:22 ` Peter Zijlstra
2025-07-01 13:13 ` [tip: objtool/urgent] " tip-bot2 for Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®