From patchwork Mon Jun 18 15:22:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 139006 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4086267lji; Mon, 18 Jun 2018 08:28:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLk3/ArC7D2TMPjXhz4oVDY526lFLkAsGZFyNfJdZatxLFA3KdNoCthoALAsxG77NCCv1T7 X-Received: by 2002:aa7:c486:: with SMTP id m6-v6mr11853413edq.266.1529335700698; Mon, 18 Jun 2018 08:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529335700; cv=none; d=google.com; s=arc-20160816; b=ZYvHp5eXXExsdjdg/XKd/6o6c0nMJhg1yvHNtj+mQCab+YGMY6Tpz5zzezKR+ljLba jnw5LR3DcO9EO/wLoAuPhm6126/IcOSCDFFk/mBxapFNwRwEIlkYH5JpBHHOk1OoJ64d i94GxeM/lZyZZe76iaHU1WU1b7Q2R6yaV6H4KNZ2RMzqsnOixDUBt2FVkWdwgVxVBpvV dpyYh023tTJpuzJeaEMMDVESJNn3m7aCI0Nx0MqFT1pFYfMmo8gV0pOjw0WRpCizyGUv 3nGIn87jGBCApm/6b0yLZOxJE9/i5nmlhafQZ5A/OTtITIJAEEAODy3QW6jf7ZU4FZN5 LKCQ== 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=JE8XLqAqInuFpwGOOmrOaJ9Pg/0nhmS49xJqnAzqE1mnXjxkvN7WiUkckY6/bf8n7f LByZXnblz4nCVLa9CKV6S/mGRRkkNPpZsmSRRbrMlCR4eCQUKv/tAdL0n+cvs5lYx16t X0oSyQh+Tp2KcVEZ7WW8Yc4fqnLtEDt7jFkn/pQgRBXwkwQ7ujnTmzQcQ0dMayqJ6NxD Helw1tgYYB4hEzNQPEDmGCPYG+yl1OimLm5Zcqxm5oU4MiiVwVyCN2Z+7FAVUVTrwqDs VO69JwxXKTLf9yv6d6NTgmB95ypR5KXqDbq8S1ZRyfoRhODPXnjz3RdrKDK54P8Hoc0z 5XQg== 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 k91-v6si5858353edc.432.2018.06.18.08.28.20; Mon, 18 Jun 2018 08:28:20 -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 24ADDC21E70; Mon, 18 Jun 2018 15:24:21 +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 71C00C21EFB; Mon, 18 Jun 2018 15:23:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 036DCC21E63; Mon, 18 Jun 2018 15:23:17 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id ACAA8C21E52 for ; Mon, 18 Jun 2018 15:23:17 +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 BC4CEAF65; Mon, 18 Jun 2018 15:23:16 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Mon, 18 Jun 2018 17:22:57 +0200 Message-Id: <20180618152315.34233-4-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 03/21] 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 };