Skip to contentSkip to conversation

objtool: Add missing endianess conversion when checking annations

PATCH In review Sven Schnelle 3 participants 5 messages May 14, 2025 – Jul 2, 2025 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: Add missing endianess conversion when checking annations

cross-compiling a kernel for x86 on s390 produces the following warning:

drivers/mfd/mc13xxx-core.o: warning: objtool: mc13xxx_reg_rmw+0xc: Unknown annotation type: 50331648

Fix this by adding the required endianess conversion.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +1 -1
index b21b12ec88d9..35fb871b2c62 100644
@@ -2316,7 +2316,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, *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4));
 
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);
Signature · 1 line
2.45.2
Tested-by on v1 1/1
#1 lore raw
Quoted 18 lines · Sven Schnelle

cross-compiling a kernel for x86 on s390 produces the following warning:

drivers/mfd/mc13xxx-core.o: warning: objtool: mc13xxx_reg_rmw+0xc: Unknown annotation type: 50331648

Fix this by adding the required endianess conversion.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +0 -0
index b21b12ec88d9..35fb871b2c62 100644

tools/objtool/check.c static int read_annotate(struct objtool_file *file, · line 2322

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2316,7 +2316,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, *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4));
 
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);
#2 lore raw
In reply to Sven Schnelle
Quoted 18 lines · Sven Schnelle

cross-compiling a kernel for x86 on s390 produces the following warning:

drivers/mfd/mc13xxx-core.o: warning: objtool: mc13xxx_reg_rmw+0xc: Unknown annotation type: 50331648

Fix this by adding the required endianess conversion.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +0 -0
index b21b12ec88d9..35fb871b2c62 100644

tools/objtool/check.c static int read_annotate(struct objtool_file *file, · line 2322

Quoted 8 lines
tools/objtool/check.c +1 -1
@@ -2316,7 +2316,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, *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4));
 
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);

Gentle ping?

maintainer
#3 lore raw
Quoted 22 lines · Sven Schnelle
Quoted 20 lines · Sven Schnelle

cross-compiling a kernel for x86 on s390 produces the following warning:

drivers/mfd/mc13xxx-core.o: warning: objtool: mc13xxx_reg_rmw+0xc: Unknown annotation type: 50331648

Fix this by adding the required endianess conversion.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +0 -0
index b21b12ec88d9..35fb871b2c62 100644
@@ -2316,7 +2316,7 @@ static int read_annotate(struct objtool_file *file,
 	}
 
Quoted 8 lines

tools/objtool/check.c static int read_annotate(struct objtool_file *file, · line 2322

Quoted 6 lines
tools/objtool/check.c +1 -1
 	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, *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4));
 
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);

Gentle ping?

Oh, I missed there were two of these. I merged this:

https://lkml.kernel.org/r/175137563313.406.6298042704364318030.tip-bot2@tip-bot2

#4 lore raw
Quoted 27 lines · Peter Zijlstra
Quoted 26 lines · Sven Schnelle
Quoted 24 lines · Sven Schnelle

cross-compiling a kernel for x86 on s390 produces the following warning:

drivers/mfd/mc13xxx-core.o: warning: objtool: mc13xxx_reg_rmw+0xc: Unknown annotation type: 50331648

Fix this by adding the required endianess conversion.

Fixes 2116b349e29a ("objtool: Generic annotation infrastructure")
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +1 -1
index b21b12ec88d9..35fb871b2c62 100644
@@ -2316,7 +2316,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, *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4));
 
Quoted 8 lines
Quoted 4 lines

tools/objtool/check.c static int read_annotate(struct objtool_file *file, · line 2322

Quoted 2 lines
tools/objtool/check.c +0 -0
 		offset = reloc->sym->offset + reloc_addend(reloc);
 		insn = find_insn(file, reloc->sym->sec, offset);

Gentle ping?

Oh, I missed there were two of these. I merged this:

https://lkml.kernel.org/r/175137563313.406.6298042704364318030.tip-bot2@tip-bot2

Ok, thanks!