OSDN Git Service

objtool: Fix x86 orc generation on big endian cross-compiles
authorVasily Gorbik <gor@linux.ibm.com>
Thu, 12 Nov 2020 23:03:29 +0000 (00:03 +0100)
committerJosh Poimboeuf <jpoimboe@redhat.com>
Thu, 14 Jan 2021 00:13:13 +0000 (18:13 -0600)
commit8bfe273238d77d3cee18e4c03b2f26ae360b5661
treecd0313607796a23f9adf6f5f60a441f84ffc69dd
parenta1a664ece586457e9f7652b0bc5b08386259e358
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>
arch/x86/include/asm/orc_types.h
tools/arch/x86/include/asm/orc_types.h
tools/objtool/arch/x86/include/arch_endianness.h [new file with mode: 0644]
tools/objtool/check.c
tools/objtool/endianness.h [new file with mode: 0644]
tools/objtool/orc_dump.c
tools/objtool/orc_gen.c
tools/objtool/special.c