From patchwork Mon Jun 18 14:08:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 138963 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4014462lji; Mon, 18 Jun 2018 07:22:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ7OL5AM+Y1+Xe7orYOPNA/OoAovhwdhsm5khQoxd+bm0zOS7LoDB9o2DtqUrXex3LiknDF X-Received: by 2002:a50:af66:: with SMTP id g93-v6mr11383216edd.220.1529331737390; Mon, 18 Jun 2018 07:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529331737; cv=none; d=google.com; s=arc-20160816; b=GFBmpGduY6GDz5/qpyePbEk1wHeVER60ER6zmOuPnP2s+yQqXYiGErF4avYRal+h12 XXL0T2q+qIqSXbYY95uveDlS+x5QYoOilJqWJmrmUPhD44Djq6RzzffW12R9lWGIsyqG 2tcFtDai9qq1G+qNsdwGgYvkgADj8dtl5HSApeBeiaEH55Nu6OOGZCz9MLv8U1NXHUXF aWVRucOhkUf7ZAMvvXD+2woSD31AKnPnKnrEd9ALnIVpRF//aidZfEggwjWY98rxm0Lw E8Q+qGfxb3OzK+B60eMuFd0sFmC+GrVdOgKgC6onkkn5fZYwjJtlM3HoA/E0sTb8AWy7 xKxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:to:from:references:message-id:in-reply-to:date:mime-version :arc-authentication-results; bh=EKPXQe/Mff4yFYZlPm8i2m8g7Vo8j7sqP+jg6zlMBEc=; b=EVq5Zg/ltbz/R/TCLdjBV0HnYqXIhRX2RtJUHtFMG4VCmcxjEXZvGyYa9pMBu9kt6Z dZMKwOpCWGvuLxJzkLvlFndOSETxkqWJ/uvSdNN3l3XSclN58eNAJnV94yHLZbzIPEJi Zsq14bAVQTjGK0n2lmBYUg+AMk9VDueTIZFdDJ7QUYlT7LFiwvEuECVzhLHZyxR3y/o0 4PL9XAymRfHeq7Oi34UUY8kfZnvSnA4eDm9TTJq8H13bjWd0cQBIAVbyxq5YK0oGgmNh HTnfcKwpbnds9Sqj0H5NMJgU4H6KbNBeJ82V7nqOqMEHuHQNlhZqxy3o9n/qGyAekxic /pNQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id g18-v6si7013750edh.52.2018.06.18.07.22.17; Mon, 18 Jun 2018 07:22:17 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: by lists.denx.de (Postfix, from userid 105) id F0DD0C21E68; Mon, 18 Jun 2018 14:14:23 +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 0D1D5C21ECA; Mon, 18 Jun 2018 14:12:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0999FC21E9F; Mon, 18 Jun 2018 14:10:00 +0000 (UTC) Received: from mail-io0-f202.google.com (mail-io0-f202.google.com [209.85.223.202]) by lists.denx.de (Postfix) with ESMTPS id 5505DC21E50 for ; Mon, 18 Jun 2018 14:09:57 +0000 (UTC) Received: by mail-io0-f202.google.com with SMTP id x14-v6so13416710ioa.6 for ; Mon, 18 Jun 2018 07:09:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=jOFGPF/4TSWjjtTuvhV9hgb8AqMpfxHCZGO7dHZPWJ4=; b=JJlKS2YxZ/YVrQdW5y6hFmp8Wg9sQ/73flK5Vr/eEwR2yOGWa/FU+Xj67xm3Yor0ns 5Hycrlj8mbLn91C8lZgOqC0MThsD8JsNQfrfSkHROfCMudd/nipmT8e3UltlNcx6GOiu LYptAM5xwPhTX0ZtyqcSG2unndmNHENMAfaiA1ezf9DAAYUM2VXN8NCYFUDDWl41K4Xo Vkh5zU60xQMATgVsE2B+/qrMc7am9TBXe+w+hc05JcOzqYkJbhQMHBLWbW906sJWIui7 u3I0wV9WbfNZ1UXdMtcgy9ohx7Dn0mNZ1Gnx8Otpb5VkgO3wjBWIAOKS+ME6WN0V4fqN Y4uw== X-Gm-Message-State: APt69E3D2Lr/MZBUWPjCPDX914t+0quqIYFSH1++sNVdSYwS1wY7w7oA c5T+jVSH+6DHmciHEKsFvpArttk= MIME-Version: 1.0 X-Received: by 2002:a24:2815:: with SMTP id h21-v6mr5071319ith.53.1529330996352; Mon, 18 Jun 2018 07:09:56 -0700 (PDT) Date: Mon, 18 Jun 2018 08:08:31 -0600 In-Reply-To: <20180618140835.195901-1-sjg@chromium.org> Message-Id: <20180618140835.195901-27-sjg@chromium.org> References: <20180618140835.195901-1-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v8 26/30] 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Alexander Graf 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 Signed-off-by: Simon Glass --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None 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 d5dd8864d7..7e281f55e4 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -20,25 +20,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 };