From patchwork Fri Jun 15 12:42:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138683 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp803321lji; Fri, 15 Jun 2018 05:48:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK8DtCbUUyKWB87Lz8P0t/G6EAOaLRP2++P2UG6Xzgf8RLzMpOXLBxlbnzePw5Ow5mXJpD6 X-Received: by 2002:a50:9643:: with SMTP id y61-v6mr1750831eda.160.1529066925127; Fri, 15 Jun 2018 05:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529066925; cv=none; d=google.com; s=arc-20160816; b=sTkEJobBSlV9KWTG378G72tll+jz+09HP/DoCxygljJUMA7+Ww4ESk/zD6greO5xnW gLE2FXYj91vXxF6Get+jjhNvr00CBldnb+4bsVJ8ZwXIywc0kJoybDlKanOgdoJRZIK7 KiahIuOtchVeV9ZB7ATbrLh+UVlj4f9xmNTGSUFA/dQiTR4E+g+bxWf39IFpHSUyQFie /zEwrIV1+KW5jMfEA4N7TGQPI1c+LmIzX6FIJe9b/zh07C2Tn6GtFI3Db+3HGh7IUp7R 0zMsbsyCeTOAgooSJOxuIGzJam/LD/yavSe93bmnweFA3FPAXqwhpA90tA4RDAfnlCwH J9qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=b3hX+Y4Nvz+OE0v6ddPN9TqJMhE1hyURr2d/9amr21c=; b=C1h24efjO3tkEL6G0cew9NtDDTlF+uw5dm7ndrLzY3DIOr2+RYOAmw5Cgwfz4wc2V9 HV1tbGsACoayPmdrbItskPF+P8KKWo0o1ZMhLkevNzwT/vm3WNRUMVsU3F7W6IY86MAc yNzOf1+8kBZIkkIi9Av8f0zFi9dn+bIxsvC6uugJyfXnQGjcMiQzTpk+rtcUjZpwKbVK CVATIO9Q4hMkqa4+KCeAMeljj1oit4dLmoyzNReyeIL6yC8CDY+QaYjFKJJkoOUVJt6e 9w6NA7o2UMn2qLWATe6G/Cr8QvjPaSACtegD+zJJiaFQmI49UumQ5Pu8sm2quypqMfTX P19w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id s31-v6si2007974edm.148.2018.06.15.05.48.44; Fri, 15 Jun 2018 05:48:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id B011BC21F18; Fri, 15 Jun 2018 12:46:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 69A60C21F58; Fri, 15 Jun 2018 12:42:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8A26EC21E96; Fri, 15 Jun 2018 12:42:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id CE2A7C21E90 for ; Fri, 15 Jun 2018 12:42:31 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3FC94AF8F; Fri, 15 Jun 2018 12:42:31 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Fri, 15 Jun 2018 14:42:27 +0200 Message-Id: <20180615124229.35310-16-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180615124229.35310-1-agraf@suse.de> References: <20180615124229.35310-1-agraf@suse.de> Cc: Andy Shevchenko , Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 15/17] efi_loader: Move to compiler based target architecture determination X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- lib/efi_loader/efi_runtime.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 388dfb9840..bc44e43745 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 #define R_RELATIVE R_386_RELATIVE #define R_MASK 0xffULL -#elif defined(CONFIG_RISCV) +#elif defined(__riscv) #include #define R_RELATIVE R_RISCV_RELATIVE #define R_MASK 0xffULL @@ -55,25 +55,15 @@ 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 - -/* For sandbox we only support 64-bit x86 at present */ -#elif defined(CONFIG_SANDBOX) -/* - * TODO(sjg@chromium.org): Consider providing a way to enable sandbox features - * based on the host architecture - */ -# ifndef __x86_64__ -# warning "sandbox EFI support is only tested on 64-bit x86" -# endif -#define R_RELATIVE 8 -#define R_MASK 0xffffffffULL #else #error Need to add relocation awareness #endif