From patchwork Thu Jun 14 18:22:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138603 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2452003lji; Thu, 14 Jun 2018 11:23:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIW1DSqsEu0HwMz4fhaYFZNrnfovSF96obactoYGew3ZDhVEj5KFXDGrQXlxBoKt4Bm5Lci X-Received: by 2002:a50:ce03:: with SMTP id y3-v6mr3495013edi.300.1529000631357; Thu, 14 Jun 2018 11:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000631; cv=none; d=google.com; s=arc-20160816; b=pxteAYA640IzERP0hKfsJ0bq8gOJxUcuX5/ePU7oiIy66jqVwQZJSFADQ2qziTdc47 BpV3K5HPPu3dLwqVy9tknJKndYd7vnKdZ41ssaKWXumPUjbHuJQuG5npeW2mBf7hUQEj 6W8vYnlmGeUjb3hUP/Kg3I4b0eLVS/+0X/zwXG9tT+R4p/JiFqa//hh4HVa4vKFdUMXR fdMZF3M92M1huPOM5e7IGTfH9Q5lN23r63U78qLjqE740qngj0cP5Av97I8Xe+CY+60L 8mG4jMnRswmZbLzf5a6R1T8ZAfL8p+HNaXhzy5VM7uLXSkFPHVE9EcmeISNz+uueA32I Vz+A== 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=hLADVp5gY4I5s7N/tHIxKRdwxCkdOm9UhFzx3SaMdAobC1Jyw910YepUjvoSoZO9Tc KmdSJelNoAoskiLKxPF6eS3nwtQd7dm81hZKQ5LExQgoXdLI1lgjjDAbuYZIC/oZa0+N uJROcX5ixVxGepS9QZOQ1zy/q9hYwgYykordpJPo6sPshql0izhLUgLrS9z+iOZ8PvYU DS0xd8qqujk+RlzCC+O15EYlDyJ6LpLDXJ2wXG9EaoE44z35+kPJyjlQSXtPcVVD64fx wRJHx9CLh/eU0hz3ZwwGp4jmSpIfJh0WZrL4U3XjHIYjDzTPgV+bYKdBQc7VhRSxzTwX dp7g== 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 u1-v6si3806706edo.45.2018.06.14.11.23.50; Thu, 14 Jun 2018 11:23:51 -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 B5266C21C2C; Thu, 14 Jun 2018 18:23:17 +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 95EBAC21DE8; Thu, 14 Jun 2018 18:22:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9D590C21C29; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 43F67C21C2C for ; Thu, 14 Jun 2018 18:22: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 9724DAFB0; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:24 +0200 Message-Id: <20180614182232.78201-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 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 };