[PATCH] tools: relocate-rela: Don't assume <elf.h> defines Microblaze stuff

Mark Kettenis kettenis at openbsd.org
Wed Jul 27 16:34:05 CEST 2022


The contents of <elf.h> differ between OSes.  It may only define
the relocation types for the host architecture, and may not contain
machine-specific defines for more obscure architectures (such as
Microblaze) at all.

Define the relevant constants for Microblaze locally if they are
not provided by <elf.h>.

Fixes: 034944b33bc8 ("tools: relocate-rela: Add support for 32bit Microblaze relocation")
Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
---
 tools/relocate-rela.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index 090fb1acb2..c57c3cfade 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -20,6 +20,26 @@
 #define R_AARCH64_RELATIVE	1027
 #endif
 
+#ifndef EM_MICROBLAZE
+#define EM_MICROBLAZE		189
+#endif
+
+#ifndef R_MICROBLAZE_NONE
+#define R_MICROBLAZE_NONE	0
+#endif
+
+#ifndef R_MICROBLAZE_32
+#define R_MICROBLAZE_32		1
+#endif
+
+#ifndef R_MICROBLAZE_REL
+#define R_MICROBLAZE_REL	16
+#endif
+
+#ifndef R_MICROBLAZE_GLOB_DAT
+#define R_MICROBLAZE_GLOB_DAT	18
+#endif
+
 static int ei_class;
 
 static uint64_t rela_start, rela_end, text_base, dyn_start;
-- 
2.37.1



More information about the U-Boot mailing list