From patchwork Mon Dec 11 08:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 121336 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2527594qgn; Mon, 11 Dec 2017 00:45:23 -0800 (PST) X-Google-Smtp-Source: ACJfBosRGJ0/dHK/jzJFk+oRjS32OjeELlQW8IwOgBeakLWmt8J9XupuVgIuJiCNHDceJLatplzc X-Received: by 10.80.143.67 with SMTP id 61mr76231edy.219.1512981923268; Mon, 11 Dec 2017 00:45:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512981923; cv=none; d=google.com; s=arc-20160816; b=mD8xuPdv0FBfRGYEStiWIux1C3+FTqafE9BNaBGkHEDPZGSDyADKGE6jzVG5/+o+qq gWtDHBMUeevgQkW3LIGu1rNZ1oGEzIsCRlKbZEtaQ7u3KcJExvCPrb4NnFTYIJrWzUJZ OUADsJjc5XnnxfHfzR6brQwv5jj6gns6Z4Z99m6w+O8W001vlWCKgLx0r8t65IHY+O9S Nito36Yaf4fWVjAkpfDBc2W3PIJu50Z4us1Jl+AXKr7a7feMa6+g8tCoyxo8BQAzg0UF 0hkdjxvlSryF/xmhWlV5ku/RttxE3YbQPBVC85WCTDo1MdozHM8cIajNKMJQeQXwnos0 VAZw== 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:message-id:date:to:from :arc-authentication-results; bh=dAzT6VeAxiGpPbmtochbTWtpz49hYQjUZXf3Svjcz+U=; b=y6rxJ7PKQlzAE6pu/w8ARfeuhYPnmDaKJaTbzMOLCtb26t2IMHrDYcivlvl+SKumeK 9/yqwrNNkKbMAodmc1zEfBSJXGdGI1rKL5S7Mlyhwm2K0W/fGRq1DFYKfMo0soFPDsv4 fiJI0P570Cq5nMoyhKsBpzNv7imp+rGX5nkk0JFGZUMgFCH9c6IzIi4jHncY36vnCsCD c4tVJnwJGCbaC0t50mWGbP3SaDUp3A2WEr4H+UWCaQ3HN8TdPR8ZEUHJZlCRCzD7p/wi jNEgaG+f0Pw90REmPSpn6wX2CpXObLvmuTOBZBBX22xJueLCFmiU8WtCfP8AAqFEN8uW u5mg== 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 g8si474200edb.338.2017.12.11.00.45.22; Mon, 11 Dec 2017 00:45:23 -0800 (PST) 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 B3398C21D64; Mon, 11 Dec 2017 08:45:19 +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=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED 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 48F2AC21C39; Mon, 11 Dec 2017 08:45:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2D41DC21C29; Mon, 11 Dec 2017 08:45:14 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 1F23AC21C29 for ; Mon, 11 Dec 2017 08:45:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9E03FAC3D; Mon, 11 Dec 2017 08:45:12 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Mon, 11 Dec 2017 09:45:11 +0100 Message-Id: <20171211084511.50385-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH] efi_loader: helloworld.c: Explicitly use .rodata for loaded_image_guid 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" Commit bbf75dd9345d0b ("efi_loader: output load options in helloworld") introduced a const variable in efi_main() called loaded_image_guid which got populated from a constant struct. While you would usually expect a compiler to realize that this variable should really just be a global pointer to .rodata, gcc disagrees and instead puts it on the stack. Unfortunately in some implementations of gcc it does so my calling memcpy() which we do not implement in our hello world environment. So let's explicitly move it to a global variable which in turn puts it in .rodata reliably and gets rid of the memcpy(). Fixes: bbf75dd9345d0b ("efi_loader: output load options in helloworld") Reported-by: Florian Fainelli Signed-off-by: Alexander Graf Reviewed-by: Heinrich Schuchardt Tested-by: Florian Fainelli --- lib/efi_loader/helloworld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index e59c24c788..b8c147d7f2 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -13,6 +13,8 @@ #include #include +static const efi_guid_t loaded_image_guid = LOADED_IMAGE_GUID; + /* * Entry point of the EFI application. * @@ -26,7 +28,6 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, struct efi_simple_text_output_protocol *con_out = systable->con_out; struct efi_boot_services *boottime = systable->boottime; struct efi_loaded_image *loaded_image; - const efi_guid_t loaded_image_guid = LOADED_IMAGE_GUID; efi_status_t ret; con_out->output_string(con_out, L"Hello, world!\n");