From patchwork Fri Jun 15 12:42:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138679 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp799660lji; Fri, 15 Jun 2018 05:44:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIETRW/bK5Mp8v6kY0+shxzs7tTCA8YVg2qcIcCIiCXduFDcyOnJYnxW6RGeGqko20+5rY1 X-Received: by 2002:a50:b671:: with SMTP id c46-v6mr1837138ede.190.1529066695482; Fri, 15 Jun 2018 05:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529066695; cv=none; d=google.com; s=arc-20160816; b=pmuZrhH7/RXCXwU6NSlUK6++DOlqv/Nl1hGAF1H+Wuz8blGhwfvVAMlHQxLze3At0I hNl96v4ETHZiNjFXzWCPUV9xwRHpfTDct+llCkI78cxJTxFy42CYYuC08bAOsVgfjakV 5GA9/vyHBDDozSa5asdfxBW7Ilu6lBtaG5Hi0ai/4rLhXqK2T3R68FbSXvQS6U/n1MEf /i2FaNVuZzUhHRI+KgM1YPMaG2metu45SahaZCz++gq5JIM2v/v0ty5nXJt/E5boCTR5 rAwi34OHyFeOgmrw1hZXGvWjLvegsxEpKCoWnbMpD+hblQLBSBZ08gFG3yV628FOmnd7 fLPg== 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=eGNlucv7CbjvuFNbEfkwOyrTncOPY+5fnwsyPauiKIeJzCyYGg6+KGdRTN20+Jr5qg ns2phEshkSJ3mW+HBBSrscPE+kAYq2zChMRC2gd4uP/mayxOqB26DHyT14FQtU/eFyx0 fCf2OgCcTD8W7lLuHTJ/LqB3V0wFzgtUJkLouo+VisyotiIgE/KeZ6I8evz61RJj2OwF rcN5tPM3cjPwCuEtQFPNtraJtpVkQlVDg3Kb9q71CS1SU1a2B9UuTEuV0doRYzAT3g7V Nw6PwGFJRwAVcKtvbWYlhJmF11XnwjIALyQFjtTkkjXbh97OsBO1nCMYXIemeo9tXtRh jXMg== 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 v3-v6si2944661ede.462.2018.06.15.05.44.55; Fri, 15 Jun 2018 05:44:55 -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 17DA6C21E2B; Fri, 15 Jun 2018 12:43:47 +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 9CCFFC21EC5; Fri, 15 Jun 2018 12:42:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0E110C21E2B; Fri, 15 Jun 2018 12:42:32 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 8AD0EC21E50 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 DB957AC7F; Fri, 15 Jun 2018 12:42:30 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Fri, 15 Jun 2018 14:42:15 +0200 Message-Id: <20180615124229.35310-4-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 03/17] 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 };