From patchwork Thu Jun 14 16:33:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138580 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2336162lji; Thu, 14 Jun 2018 09:34:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIavYVSrdl6aQxr9dIpfTXEWczqzSi9gBrcAK567AzOXultivrO7Lv7jVmusp038p765Sw2 X-Received: by 2002:a50:b223:: with SMTP id o32-v6mr3220502edd.184.1528994087252; Thu, 14 Jun 2018 09:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994087; cv=none; d=google.com; s=arc-20160816; b=xHUkKY2HWPeEbo9d+cuzahVhyg3tBpZpxP77ess6146cFT9jmC8xhx2jYEI+0NIxtZ df80HDpIDYSm+SvGwBW6Gvj4AeYmVY5nvs45g8rulb0O/FjErTI3vMZYFTu2XLCAyXew uaSO6JHOu/hK2Rv4wtrZxnU1be1qVOAm61vMgM2qVQ/dMcotEqOGKAdSgWlujCJ5WQgH k33feaiIx1WchVq8VQ/WEFyS4BB0FVBw8Se68BB+ds02R6rYrFBC/V1dY3RK3fUqdGoH eB8bYKUVyq1rxOBRa7FSvo9KKt1H34tKeSjOkIv9mBhllXDD826i8vRkXqQazoruRUvz MXbA== 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=73m/NCdF9/Nr1lITe5I0+h+ywV5cqcdYnp+RAcAenII=; b=TVERNtynAa9uFd9eGfXEhGUqUbHIUWCY8JhfYhRjpCdGLaUpyWWIkBUtwYZjW7trnI C+wuZ1UeL127xhN0tY4FXD9J1+C2ctrABhvPrdmRrBTC3vPUPz7bMERni98+5ng4ZzrN 3mn5QzHq6sjAf4v96blU59YXSJczI9NE+F9zPPH/oOOAWeZ/t4vaBmCnGA9cjV/0AGeE YZQGDkFt7nWGC9nqxAdhVbgwtGFJmfQxijumdTnZ7buBPPVhTdEsvO4DA6gBM37YUDiP KuuU7lneiNMsZF51iPw2hsWW0zh2nBAi3GZ/zJc1nW1wsY1OInT9qVpveBVzeCpO7BPQ LobQ== 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 x21-v6si4770164edx.74.2018.06.14.09.34.35; Thu, 14 Jun 2018 09:34:47 -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 AD619C21D8A; Thu, 14 Jun 2018 16:33:57 +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 83641C21DED; Thu, 14 Jun 2018 16:33:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BCF1FC21D74; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 4F9D1C21D8A for ; Thu, 14 Jun 2018 16:33:35 +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 ACB51AED0; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:26 +0200 Message-Id: <20180614163334.46827-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 03/11] efi_loader: Use compiler constants for image loader 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" The EFI image loader tries to determine which target architecture we're working with to only load PE binaries that match. So far this has worked based on CONFIG defines, because the target CPU was always indicated by a config define. With sandbox however, this is not longer true as all sandbox targets only encompass a single CONFIG option and so we need to use compiler defines to determine the CPU architecture. Signed-off-by: Alexander Graf --- lib/efi_loader/efi_image_loader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index ecdb77e5b6..fdf40a62c8 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -19,25 +19,25 @@ const efi_guid_t efi_simple_file_system_protocol_guid = const efi_guid_t efi_file_info_guid = EFI_FILE_INFO_GUID; static int machines[] = { -#if defined(CONFIG_ARM64) +#if defined(__aarch64__) IMAGE_FILE_MACHINE_ARM64, -#elif defined(CONFIG_ARM) +#elif defined(__arm__) IMAGE_FILE_MACHINE_ARM, IMAGE_FILE_MACHINE_THUMB, IMAGE_FILE_MACHINE_ARMNT, #endif -#if defined(CONFIG_X86_64) +#if defined(__x86_64__) IMAGE_FILE_MACHINE_AMD64, -#elif defined(CONFIG_X86) +#elif defined(__i386__) IMAGE_FILE_MACHINE_I386, #endif -#if defined(CONFIG_CPU_RISCV_32) +#if defined(__riscv) && (__riscv_xlen == 32) IMAGE_FILE_MACHINE_RISCV32, #endif -#if defined(CONFIG_CPU_RISCV_64) +#if defined(__riscv) && (__riscv_xlen == 64) IMAGE_FILE_MACHINE_RISCV64, #endif 0 };