tools: relocate-rela: Don't assume <elf.h> defines Microblaze stuff
PATCH 1/1 tools: relocate-rela: Don't assume <elf.h> defines Microblaze stuff
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>.
--- tools/relocate-rela.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tools/relocate-rela.c +20 -0
@@ -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;
Signature · 1 line
2.37.1
Quoted 35 lines · Mark Kettenis
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 <[email protected]>--- tools/relocate-rela.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)tools/relocate-rela.c +13
-0@@ -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
tools/relocate-rela.c line 45
Quoted 10 lines
tools/relocate-rela.c +7
-0+#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;
It is fixed already in the latest master branch. Tom merged it yesterday. Please take a look.
Thanks,
Michal
Quoted 48 lines
Date: Wed, 27 Jul 2022 17:59:02 +0200
From: Michal Simek <[email protected]>Quoted 44 lines · Mark Kettenis
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 <[email protected]>--- tools/relocate-rela.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)tools/relocate-rela.c +20
-0@@ -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;
Quoted 5 lines
tools/relocate-rela.c line 45
Quoted 1 line
tools/relocate-rela.c +0
-0static uint64_t rela_start, rela_end, text_base, dyn_start;It is fixed already in the latest master branch. Tom merged it yesterday. Please take a look.
Ah great, missed that. Works for me!