aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/objtool/orc_dump.c
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2020-11-13 00:03:29 +0100
committerJosh Poimboeuf <jpoimboe@redhat.com>2021-01-13 18:13:13 -0600
commit8bfe273238d77d3cee18e4c03b2f26ae360b5661 (patch)
treecd0313607796a23f9adf6f5f60a441f84ffc69dd /tools/objtool/orc_dump.c
parentobjtool: Fix reloc generation on big endian cross-compiles (diff)
downloadwireguard-linux-8bfe273238d77d3cee18e4c03b2f26ae360b5661.tar.xz
wireguard-linux-8bfe273238d77d3cee18e4c03b2f26ae360b5661.zip
objtool: Fix x86 orc generation on big endian cross-compiles
Correct objtool orc generation endianness problems to enable fully functional x86 cross-compiles on big endian hardware. Introduce bswap_if_needed() macro, which does a byte swap if target endianness doesn't match the host, i.e. cross-compilation for little endian on big endian and vice versa. The macro is used for conversion of multi-byte values which are read from / about to be written to a target native endianness ELF file. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Diffstat (limited to 'tools/objtool/orc_dump.c')
-rw-r--r--tools/objtool/orc_dump.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c
index 5e6a95368d35..4e818a22e44b 100644
--- a/tools/objtool/orc_dump.c
+++ b/tools/objtool/orc_dump.c
@@ -8,6 +8,7 @@
#include <asm/orc_types.h>
#include "objtool.h"
#include "warn.h"
+#include "endianness.h"
static const char *reg_name(unsigned int reg)
{
@@ -197,11 +198,11 @@ int orc_dump(const char *_objname)
printf(" sp:");
- print_reg(orc[i].sp_reg, orc[i].sp_offset);
+ print_reg(orc[i].sp_reg, bswap_if_needed(orc[i].sp_offset));
printf(" bp:");
- print_reg(orc[i].bp_reg, orc[i].bp_offset);
+ print_reg(orc[i].bp_reg, bswap_if_needed(orc[i].bp_offset));
printf(" type:%s end:%d\n",
orc_type_name(orc[i].type), orc[i].end);