aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2018-06-18 17:23:08 +0200
committerAlexander Graf <agraf@suse.de>2018-07-25 14:57:43 +0200
commitbc028919e4e3c1e69437ba0d93751ff099f6c6c9 (patch)
tree3a25902b23d0526dde5d5a61b6fb811f9f0dea19 /lib
parentbeb077a2a8201c4b215d82e58c4d1d8ec8e48b58 (diff)
downloadu-boot-bc028919e4e3c1e69437ba0d93751ff099f6c6c9.zip
u-boot-bc028919e4e3c1e69437ba0d93751ff099f6c6c9.tar.gz
u-boot-bc028919e4e3c1e69437ba0d93751ff099f6c6c9.tar.bz2
efi_loader: Move to compiler based target architecture determination
Thanks to CONFIG_SANDBOX, we can not rely on config options to tell us what CPU architecture we're running on. The compiler however does know that, so let's just move the ifdefs over to compiler based defines rather than kconfig based options. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_runtime.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 4874eb6..bc44e43 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -32,18 +32,18 @@ static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
* TODO(sjg@chromium.org): These defines and structs should come from the elf
* header for each arch (or a generic header) rather than being repeated here.
*/
-#if defined(CONFIG_ARM64)
+#if defined(__aarch64__)
#define R_RELATIVE 1027
#define R_MASK 0xffffffffULL
#define IS_RELA 1
-#elif defined(CONFIG_ARM)
+#elif defined(__arm__)
#define R_RELATIVE 23
#define R_MASK 0xffULL
-#elif defined(CONFIG_X86)
+#elif defined(__x86_64__) || defined(__i386__)
#include <asm/elf.h>
#define R_RELATIVE R_386_RELATIVE
#define R_MASK 0xffULL
-#elif defined(CONFIG_RISCV)
+#elif defined(__riscv)
#include <elf.h>
#define R_RELATIVE R_RISCV_RELATIVE
#define R_MASK 0xffULL
@@ -55,12 +55,14 @@ struct dyn_sym {
u32 foo2;
u32 foo3;
};
-#ifdef CONFIG_CPU_RISCV_32
+#if (__riscv_xlen == 32)
#define R_ABSOLUTE R_RISCV_32
#define SYM_INDEX 8
-#else
+#elif (__riscv_xlen == 64)
#define R_ABSOLUTE R_RISCV_64
#define SYM_INDEX 32
+#else
+#error unknown riscv target
#endif
#else
#error Need to add relocation awareness