diff options
author | Vasily Gorbik <gor@linux.ibm.com> | 2020-11-13 00:03:29 +0100 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@redhat.com> | 2021-01-14 01:13:13 +0100 |
commit | 8bfe273238d77d3cee18e4c03b2f26ae360b5661 (patch) | |
tree | cd0313607796a23f9adf6f5f60a441f84ffc69dd /tools/objtool/arch | |
parent | objtool: Fix reloc generation on big endian cross-compiles (diff) | |
download | linux-8bfe273238d77d3cee18e4c03b2f26ae360b5661.tar.xz 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/arch')
-rw-r--r-- | tools/objtool/arch/x86/include/arch_endianness.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/objtool/arch/x86/include/arch_endianness.h b/tools/objtool/arch/x86/include/arch_endianness.h new file mode 100644 index 000000000000..7c362527da20 --- /dev/null +++ b/tools/objtool/arch/x86/include/arch_endianness.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _ARCH_ENDIANNESS_H +#define _ARCH_ENDIANNESS_H + +#include <endian.h> + +#define __TARGET_BYTE_ORDER __LITTLE_ENDIAN + +#endif /* _ARCH_ENDIANNESS_H */ |