diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2022-11-14 20:57:47 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-11-18 11:00:15 +0300 |
commit | 0646c28b417b7fe307c9da72ca1c508e43b57dc0 (patch) | |
tree | 6e655e14bea59180dfa17356ad5f6f993f1b2918 /tools/objtool/special.c | |
parent | efb11fdb3e1a9f694fa12b70b21e69e55ec59c36 (diff) | |
download | linux-0646c28b417b7fe307c9da72ca1c508e43b57dc0.tar.xz |
objtool: Use target file endianness instead of a compiled constant
Some architectures like powerpc support both endianness, it's
therefore not possible to fix the endianness via arch/endianness.h
because there is no easy way to get the target endianness at
build time.
Use the endianness recorded in the file objtool is working on.
Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221114175754.1131267-10-sv@linux.ibm.com
Diffstat (limited to 'tools/objtool/special.c')
-rw-r--r-- | tools/objtool/special.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/objtool/special.c b/tools/objtool/special.c index e2223dd91c37..9c8d827f69af 100644 --- a/tools/objtool/special.c +++ b/tools/objtool/special.c @@ -87,7 +87,8 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry, if (entry->feature) { unsigned short feature; - feature = bswap_if_needed(*(unsigned short *)(sec->data->d_buf + + feature = bswap_if_needed(elf, + *(unsigned short *)(sec->data->d_buf + offset + entry->feature)); arch_handle_alternative(feature, alt); |