[PATCH 1/2] tools: relocate-rela: Remove guard around R_AARCH64_RELATIVE

In code you can find out this fragment: 19 #ifndef R_AARCH64_RELATIVE 20 #define R_AARCH64_RELATIVE 1027 21 #endif
which means that R_AARCH64_RELATIVE is defined all the time that's why ifdef is not needed.
Signed-off-by: Michal Simek michal.simek@amd.com ---
tools/relocate-rela.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 090fb1acb20c..13cce24151c7 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -43,10 +43,8 @@ static bool supported_rela(Elf64_Rela *rela) uint32_t type = rela->r_info & mask;
switch (type) { -#ifdef R_AARCH64_RELATIVE case R_AARCH64_RELATIVE: return true; -#endif default: fprintf(stderr, "warning: unsupported relocation type %" PRIu32 " at %" PRIx64 "\n",

With some old toolchain not all values should be available that's why better to define all of them to avoid compilation issues.
Signed-off-by: Michal Simek michal.simek@amd.com ---
tools/relocate-rela.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 13cce24151c7..0d4c85a7f71b 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -16,10 +16,34 @@ #include <string.h> #include "compiler.h"
+#ifndef EM_AARCH64 +#define EM_AARCH64 183 +#endif + #ifndef R_AARCH64_RELATIVE #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;

On 7/8/22 08:15, Michal Simek wrote:
With some old toolchain not all values should be available that's why better to define all of them to avoid compilation issues.
Signed-off-by: Michal Simek michal.simek@amd.com
tools/relocate-rela.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 13cce24151c7..0d4c85a7f71b 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -16,10 +16,34 @@ #include <string.h> #include "compiler.h"
+#ifndef EM_AARCH64 +#define EM_AARCH64 183 +#endif
- #ifndef R_AARCH64_RELATIVE #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;
Applied both. M
participants (1)
-
Michal Simek