From patchwork Mon Jun 18 15:23:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 139017 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4090262lji; Mon, 18 Jun 2018 08:32:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKoejF50eJBmV89HjXe4uUbNZMx5/c3nEfo33ZXV2Shd3wGHexDKWmkNtV4GVSLAo4bAvKe X-Received: by 2002:a50:8810:: with SMTP id b16-v6mr11992561edb.274.1529335924094; Mon, 18 Jun 2018 08:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529335924; cv=none; d=google.com; s=arc-20160816; b=TUVvrVdkUFm2Et6rQfZ6dXh9I7NS8u2UjdPljW+3Xt85bCTrqpGCUXjfj7GBCv7Nhn 465P99tH1UpGMHDhm/4ZlDJtq7ac7J4Ua8+jR9yr2HO50097DdTBn4/NogDrYJDj+lmQ ortFWUfGJJKTfZoVfeyvmReZg/RXq8z0KV3gPXxspqi0W0sZQeeZzS46j7HzueLbKIkk Av+bdkzuSxeM/QoUm6doijR2Dk+uVlFaya4WpnxTYyieNuUzryNbi9NtU48mZ68GnoA4 8+2p0dfTwfiRoqc5cgC9nmmq8bwYoXGYFV3CACsx+yVaA53U+PE7XAikY+jHoc+dB76M y1aw== 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=G/06vvgMC8U1s8fqVbIErn00Bmcu7oJKPlwFBs0tdjTzW9uHf3RQV8TUjpWU1IIQk1 VAJw5wnIXUeB5bQlLrHAsZs3gKidcb/LuErP66Fk60losfIwCNoAy3FMocK/Lei3j9sg MNRKhxzrKYygGTMW0qoWr+D2gpQ/4+EWHEnhNW6KUxBRZ92Hh/0xFVRAD4+XtRZLTQkI TSoFajNYb6J+ocBJsLuuurbNksgm9Tb8C0GqUH+YfXIjfxnSXfkKOEqUPti3oKMhQMf+ sIUGIPklhIc0wpbWmbwsFXOt+BAc4xOLuN5vzozQCqDtJn9FYV+ESQQe0XofbWy+RyqH KuWQ== 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 z42-v6si5590063edd.118.2018.06.18.08.32.03; Mon, 18 Jun 2018 08:32:04 -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 B0CE4C21F03; Mon, 18 Jun 2018 15:27:16 +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 C9A9DC21F45; Mon, 18 Jun 2018 15:23:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EA8DAC21E1D; Mon, 18 Jun 2018 15:23:18 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id EB323C21E38 for ; Mon, 18 Jun 2018 15:23:17 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 442B1AF7A; Mon, 18 Jun 2018 15:23:17 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Mon, 18 Jun 2018 17:23:08 +0200 Message-Id: <20180618152315.34233-15-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180618152315.34233-1-agraf@suse.de> References: <20180618152315.34233-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v4 14/21] 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