[v4,17/21] efi_loader: Use common elf.h reloc defines

Message ID 20180618152315.34233-18-agraf@suse.de
State Accepted
Commit b34662d03bb9e695d12bf995df4bec8998f91609
Headers show
Series
  • sandbox: efi_loader support
Related show

Commit Message

Alexander Graf June 18, 2018, 3:23 p.m.
Now that elf.h contains relocation defines for all architectures
we care about, let's just include it unconditionally and refer to
the defines.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/efi_runtime.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Alexander Graf June 21, 2018, 3:13 p.m. | #1
> Now that elf.h contains relocation defines for all architectures
> we care about, let's just include it unconditionally and refer to
> the defines.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Thanks, applied to efi-next

Alex

Patch

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index bc44e43745..dd3ff8ad23 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -8,6 +8,7 @@ 
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <elf.h>
 #include <efi_loader.h>
 #include <rtc.h>
 
@@ -33,18 +34,16 @@  static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
  * header for each arch (or a generic header) rather than being repeated here.
  */
 #if defined(__aarch64__)
-#define R_RELATIVE	1027
+#define R_RELATIVE	R_AARCH64_RELATIVE
 #define R_MASK		0xffffffffULL
 #define IS_RELA		1
 #elif defined(__arm__)
-#define R_RELATIVE	23
+#define R_RELATIVE	R_ARM_RELATIVE
 #define R_MASK		0xffULL
 #elif defined(__x86_64__) || defined(__i386__)
-#include <asm/elf.h>
 #define R_RELATIVE	R_386_RELATIVE
 #define R_MASK		0xffULL
 #elif defined(__riscv)
-#include <elf.h>
 #define R_RELATIVE	R_RISCV_RELATIVE
 #define R_MASK		0xffULL
 #define IS_RELA		1