aboutsummaryrefslogtreecommitdiff
path: root/tools/prelink-riscv.c
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2019-08-02 19:45:15 +0200
committerAndes <uboot@andestech.com>2019-08-15 13:42:28 +0800
commite604410d3eafc77e1b9a7fbb0580a23e528f0037 (patch)
treed7c21bba43f08632871ff0978eed7cbba46f5a73 /tools/prelink-riscv.c
parent88af42d3deed0fa705706b134cc50485f3bddcef (diff)
downloadu-boot-e604410d3eafc77e1b9a7fbb0580a23e528f0037.zip
u-boot-e604410d3eafc77e1b9a7fbb0580a23e528f0037.tar.gz
u-boot-e604410d3eafc77e1b9a7fbb0580a23e528f0037.tar.bz2
riscv: tools: Fix prelink-riscv to work on big endian hosts
All ELF fields whose values are inspected by the code are converted to CPU byteorder first. Values which are copied verbatim (relocation fixups) are not swapped to CPU byteorder and back as it is not needed. Signed-off-by: Marcus Comstedt <marcus@mc.pp.se> Cc: Rick Chen <rick@andestech.com> Reviewed-by: Rick Chen <rick@andestech.com>
Diffstat (limited to 'tools/prelink-riscv.c')
-rw-r--r--tools/prelink-riscv.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/prelink-riscv.c b/tools/prelink-riscv.c
index 52eb78e..a900a14 100644
--- a/tools/prelink-riscv.c
+++ b/tools/prelink-riscv.c
@@ -8,10 +8,6 @@
* without fixup. Both RV32 and RV64 are supported.
*/
-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
-#error "Only little-endian host is supported"
-#endif
-
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
@@ -25,6 +21,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <compiler.h>
#ifndef EM_RISCV
#define EM_RISCV 243