From patchwork Thu May 18 09:09:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100063 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp622854qge; Thu, 18 May 2017 02:10:07 -0700 (PDT) X-Received: by 10.84.236.67 with SMTP id h3mr3553984pln.86.1495098607255; Thu, 18 May 2017 02:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495098607; cv=none; d=google.com; s=arc-20160816; b=QQK+f5AYkVKBmMro65JLqw0eOAtvVqRtjZnNLSn+VxATrGProJxcroOrJbSlPNebbE iVPKUlup9tZQ8s2lV7OpzHhC1DBVj7eZMP2z/Ei6z/Eu5y/n9jOsbHFxIFZU8FRtNWuu c1pM0wRHM4ukhAJ+Jl8Z2QFVIGyFav2tVnnKZF4QJjJxzW//iR6aHyemBr9RLrYDY6rz /G+l8MVXeSUaLnGzuG6aITUieNh2nkV1q6v+a/NRGMwTihaQkY6UbCuXOwr3DfLK5Dto i1YnyeyCAtyraQkwvQiNq3RKi39kcpdg+tLQd8sVbcpL8BVpJHdGOhPazg8nDipqgey6 N6Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=r4B9pNXsJuixV6NTaOK0MFiAEK9C4cnkKRvaTD/x4pg=; b=LSnqnCygwjfycdUKRsxkSUkrfM3y8yhOVX5uBPwsRQ1VE3GkwvBVAvkin/p5i0bo9K fWoWA+QOdgEAdPKq2YNo3mioia4dUd8no4E46krPpuDsoCCN1WXauimxm1zADuWElAlU lWNdLfA2f5Mnzz97VNb5hPCdvx34QjF3oXxn0QBpFMCEkoXTRdqhMUeOlYYDDerQ/JOL lDSkTmjxhhB14fhW6mzVn5/YklGTP4TeA71Bns44jfKRTn/YoqCAtJUIk4teBoaGzXPh sfBJlUy5ys9O5BWHSukN++elZTUO1l7yfgYY2UJZTOEyjx62RFT++Yjdr0rbG6WhlmRN wj9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si4627265pge.155.2017.05.18.02.10.07; Thu, 18 May 2017 02:10:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755074AbdERJKG (ORCPT + 2 others); Thu, 18 May 2017 05:10:06 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:36607 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbdERJKF (ORCPT ); Thu, 18 May 2017 05:10:05 -0400 Received: by mail-wm0-f44.google.com with SMTP id 70so38932617wmq.1 for ; Thu, 18 May 2017 02:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k9jYkXf6ezg+TdKcRTvcryICF4TrYc0Wo/3UF5p2Ei4=; b=FGCpS3yuEzl19AlGHqk94fTH/6NLZQjSKG1R5NKiKNRUYRZPCJjjLhZPvUrvSkxG1w KhtluanWxd+ZmU6268gogv8PRRXHttl0CYFtR4TjXgMEHAXeB6Er2zj4fb60AnM+uL74 f9qVmDmTY/h0I3hYBhTbyjyUZxpMOqr4HCNCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=k9jYkXf6ezg+TdKcRTvcryICF4TrYc0Wo/3UF5p2Ei4=; b=XxlS7qObos7FJtMVS1N5hEP2vuDP791rakBNuJtIf/FjANizV9VxPMWhLJywOrlC8i 9fF8bHtXs9KCwe8LPdoeK4C/9Zh/HrZz0eYnSJFUWMadBajrAwBP0je6u1WONIVEi5ek 80x+CH5NkR2gbtU5RaBGF9/K2ff0htENtvWaXQTPwEjNKWsLFvbFcK7X3M+7ap8RImcq qDqYb6UZcAnEbVvpkHRV3YY2k7BmkUOypYXlpOHgtlRLNLU0c2TV+5rl3m0h/zpCp8mZ 6/Db3EMu6yGcUC61NzxNH6aQnD+AkyS3iEP7E7PXXJCbzYzwAzLXPg4KtZpa3dkiKYsz 68vQ== X-Gm-Message-State: AODbwcDPOBGqxAPJVaREdxGIg5ceOzMv6RT3lkWnP/DLOteOpGigl2VP 5OSWvruSd9eQWbYJ X-Received: by 10.80.146.51 with SMTP id i48mr2466157eda.48.1495098604457; Thu, 18 May 2017 02:10:04 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id t17sm1406355edh.1.2017.05.18.02.10.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 02:10:03 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: mark.rutland@arm.com, ghackmann@google.com, matt@codeblueprint.co.uk, mka@chromium.org, Bernhard.Rosenkranzer@linaro.org, grundler@chromium.org, md@google.com, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 1/3] efi/libstub: arm64: use hidden attribute for struct screen_info reference Date: Thu, 18 May 2017 10:09:51 +0100 Message-Id: <20170518090953.32628-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170518090953.32628-1-ard.biesheuvel@linaro.org> References: <20170518090953.32628-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org To prevent the compiler from emitting absolute references to screen_info when building position independent code, redeclare the symbol with hidden visibility. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/efi.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Tested-by: Matthias Kaehlcke diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 8f3043aba873..464ac850c5e2 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -81,6 +81,9 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base, #define alloc_screen_info(x...) &screen_info #define free_screen_info(x...) +/* redeclare as 'hidden' so the compiler will generate relative references */ +extern struct screen_info screen_info __attribute__((__visibility__("hidden"))); + static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt) { } From patchwork Thu May 18 09:09:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100064 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp622868qge; Thu, 18 May 2017 02:10:10 -0700 (PDT) X-Received: by 10.99.52.70 with SMTP id b67mr3410472pga.44.1495098609928; Thu, 18 May 2017 02:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495098609; cv=none; d=google.com; s=arc-20160816; b=h6frX1H9JCEXq0ice9Y9pCVrKrKxlnR/7VvpBeqBVhcvSyCW9tLq/7DvY+O/xx10y4 RspI98lBZf/qA82o5uNNErPPZL5YVDA9yIbnEuOLLRk8Cr2ZvcPSiafBEawzkmW1jz+2 zCm9K/oUM1dnmzuZww9RdPtkUjhH8nTKVF75DPNFV/rrbsA9cB8rCs95kPLOt2ReBFPU tshze4HYxIROmjGtU1j2XaTCwYrfaugENAOpSn8cCyrqH/6tc8lgm7GcYUpHvjc8IzwB lXFuv62/CimYN4FlIW0gukXQSZJ5EUwpdKReIEZwtUd5b4SunayaGlwlzWG27bV9hDqF zh3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JACxjbgKr16TJfRRPcWELM7Ka6lAjlO2qbD0N5MwRcY=; b=DpVGhURuiXQxN2v5yFrwXbgrpmBbnPJd3aIN//+FGCYzxPkJOAA3J8950jg5fqLuQJ pPyJk1Y9ulC4AlOodeHBbhwpAHq/d/OqI9gd+arAMA/MGv9LCIOf5nXYyddM5vrH2/iV wmnpRGC4RH6NUW3O0rad0dtM5HagkVlJ7G/bwLudaRwz0aBHEI/023WdPZuoCrtgf5gZ wtYEjjPa8y3LI8qAMOIrWFnOUoKTeLtgHTOdsI1gpNaMPkbOBz7WTpCCpAzwZMimvX5U 7YuKrOt/xWdwnvKOiY4sDpQBEkhTcdGThZ70jkB2Il+vcB+dP1ASkhCiXoC94l8gMw07 u/dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si4627265pge.155.2017.05.18.02.10.09; Thu, 18 May 2017 02:10:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755317AbdERJKJ (ORCPT + 2 others); Thu, 18 May 2017 05:10:09 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:35088 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755130AbdERJKI (ORCPT ); Thu, 18 May 2017 05:10:08 -0400 Received: by mail-wm0-f46.google.com with SMTP id b84so193967719wmh.0 for ; Thu, 18 May 2017 02:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DNp3qkMnZfs77pPQiwGCELEqJ66JV1rv0BkiVbJyxLQ=; b=cW7BqYUwaTzcFAf2q7VZqVNmiinWuWKhRZa3JVSIs1LK8Mbi7BrD+s9ws7r3RLCOZg bsFoMUJbJmuT4WpoeaIyuVizUVBrCf3jRYK1stflTz53WenhvDghrRKoqDdfLCAfpuk8 p4BB/G1MYZAoAiMNAu0Zw+NbSzAys6R68TcTU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DNp3qkMnZfs77pPQiwGCELEqJ66JV1rv0BkiVbJyxLQ=; b=HBRiZqJKaHu101aTAf4FIr+qWzUeL1Aoo96elOUu/11n/KbaDKZoOrjx9UXGAKOD3A ySNPNhtDSw2z8N3UFlclo4SOvhGqA6eh7A792feY1vOwQ/iNdiPhD/ogVeDsr9dx8xAT RB4FNqVvW3CmreUiXuKwwBVoeSYkqRJAKcSq/mx5fnBPuAzeyKi4lubH98KQwvrh7gRK gR9hzk6v4Te8AZTjpGN4sNONYJ9B6jFIK5oOUr157eWkBDHFegul3tRHUfDjTU3OmC1m ngcq5mu/lNORG1UvFJvuUbh4X7ZN2eQDHx9LHyU/TVXZhodA41eLwoE2Q8wSXhgPsHu5 fbzQ== X-Gm-Message-State: AODbwcC1P2hp6J+RZ/c7EhIaMOW05bKxSaw9VRnzHb2E01vHVq68W4dJ UbR+0j3Akl5+RVSw X-Received: by 10.80.165.105 with SMTP id z38mr2457791edb.60.1495098606864; Thu, 18 May 2017 02:10:06 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id t17sm1406355edh.1.2017.05.18.02.10.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 02:10:06 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: mark.rutland@arm.com, ghackmann@google.com, matt@codeblueprint.co.uk, mka@chromium.org, Bernhard.Rosenkranzer@linaro.org, grundler@chromium.org, md@google.com, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 2/3] efi/libstub: arm64: force 'hidden' visibility for section markers Date: Thu, 18 May 2017 10:09:52 +0100 Message-Id: <20170518090953.32628-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170518090953.32628-1-ard.biesheuvel@linaro.org> References: <20170518090953.32628-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org To prevent the compiler from emitting absolute references to the section markers when running in PIC mode, override the visibility to 'hidden' for all contents of asm/sections.h Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm64-stub.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Tested-by: Matthias Kaehlcke diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c index b4c2589d7c91..f7a6970e9abc 100644 --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -9,9 +9,17 @@ * published by the Free Software Foundation. * */ + +/* + * To prevent the compiler from emitting GOT-indirected (and thus absolute) + * references to the section markers, override their visibility as 'hidden' + */ +#pragma GCC visibility push(hidden) +#include +#pragma GCC visibility pop + #include #include -#include #include #include "efistub.h" From patchwork Thu May 18 09:09:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100065 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp622887qge; Thu, 18 May 2017 02:10:13 -0700 (PDT) X-Received: by 10.99.127.73 with SMTP id p9mr3386350pgn.169.1495098613289; Thu, 18 May 2017 02:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495098613; cv=none; d=google.com; s=arc-20160816; b=S3bYwH+bpsdjshrW14n199xDIF6H33WbDZZ3qbjADxVpfYsr5bu3X+t6x+mYIn/cU0 ZSLMIw646W+3BMzj3y01MBS/aiI3e9CNtgAvgO9BwnR6+9KIrr8I7JigcaQeUuNWUnD9 8/Iakj6XU1WGIlgI3jtvRmPB5lRWRUvlSeFGwPBCabQRger+iNuOvSKSRmW8crg3fXKV 1JI2FyD8aEF8KAyGxQByn/1Wtuoq2mJrDHG40gbFNKxk9oZbHNhiIwrZ4jUHvNObhIbx BtdXUbj+9hZ5tlIY6T5rd/KTpb3iiVLr6pN3ZIx+HagcMDbolTgSZukpKnPWXJUOwsH5 zVkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=8rUV/rq1kNPk3NAUQv5B4C7esIjhJK4a6VXAOTwJ00U=; b=k/KOC6hAt773YFYlDkPUJAYc3bFZhzV4D7TV8FuMtpBIXL/vfCSAm1tx579sK/lV48 3mTC7tjn8Q+zKuKi2pxNFzjcbhCdPry8qxjECGGpBmWUKTVElHWFjjV2FnCJ76u4VYE8 jj1swptZevclDOuGDok/UsFJ+QYGuaYd8/23ptQMDRR3qKcm68k2bOYuytptf6CYmVlz gzsjciG6u5maBDJxyt4o1fdjt5kDV7c+im5BGkkr8TE7+tkIhQmwVZE3QfPOOcBkqisp fLoHbRyUQYW5MxrTq0jCXEjs/5pavKPS155veFUHDtXKhPyKe9FwCE8KYQnRzaHFCBEe /aNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si4627265pge.155.2017.05.18.02.10.12; Thu, 18 May 2017 02:10:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755314AbdERJKM (ORCPT + 2 others); Thu, 18 May 2017 05:10:12 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38341 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755130AbdERJKL (ORCPT ); Thu, 18 May 2017 05:10:11 -0400 Received: by mail-wm0-f54.google.com with SMTP id v15so44878220wmv.1 for ; Thu, 18 May 2017 02:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7bmH054GHVJV2UpoTpTiCI1JqnTTtopIfvS8K38pvIs=; b=HsSoCNjQguCL0Il93hy3r/dvbxiaheH0S1sKSgHd/dsGynjUO0DuaZMIldCIqT+lcM 8h30ystsylUOfVTopHJshhn+jcC+Rzhtgh8N/E4sBoyy2R0a4gLgmnDPkn8YGDyUt3no VpQ7lW4PhZVhiLQeLLKYh0Q4g0MhUqN5bEJiE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7bmH054GHVJV2UpoTpTiCI1JqnTTtopIfvS8K38pvIs=; b=LcXIAzudmIPTw4iGT5sIg968WUa34KWnh9rT+/LPgwpv6rTkv0CW4pu6m1j8OP2rnh cnpAfPRRU+toGPIQHJn5/gUoTyrNRVjiZAL/iPpnfkOnIxEhTJQuBJgElvFAcxT7tOVp gO/E29sg8Py5gQgW1Q/DU/Ca/AbX6e+aqGXepu0F7tCYXRmhYB8QyNAvriwPkKfWG2Kd XFa/OBPne1gnnkQWlGpRGS26LErsXSpfVfBcA/5rK4bThlYKrW4GSxF4NTVE1U0LJyFn 1/4TZGU+tzGw7QTaKRL8PbsDvJU0ecMw/Sa8LDY7lEU808J+7yNozSJQGd/cIThgjFKo L+2g== X-Gm-Message-State: AODbwcDkzwSLNhIOeOOXK7bXU9+qDHI4Otcx0T0np5WUkA9sJnRBUrJp RP98geCjX7Lbfc77 X-Received: by 10.80.146.71 with SMTP id j7mr2477717eda.17.1495098609756; Thu, 18 May 2017 02:10:09 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id t17sm1406355edh.1.2017.05.18.02.10.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 02:10:08 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: mark.rutland@arm.com, ghackmann@google.com, matt@codeblueprint.co.uk, mka@chromium.org, Bernhard.Rosenkranzer@linaro.org, grundler@chromium.org, md@google.com, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 3/3] efi/libstub: arm64: set -fpie when building the EFI stub Date: Thu, 18 May 2017 10:09:53 +0100 Message-Id: <20170518090953.32628-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170518090953.32628-1-ard.biesheuvel@linaro.org> References: <20170518090953.32628-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Clang may emit absolute symbol references when building in non-PIC mode, even when using the default 'small' code model, which is already mostly position independent to begin with, due to its use of adrp/add pairs that have a relative range of +/- 4 GB. The remedy is to pass the -fpie flag, which can be done safely now that the code has been updated to avoid GOT indirections (which may be emitted due to the compiler assuming that the PIC/PIE code may end up in a shared library that is subject to ELF symbol preemption) Passing -fpie when building code that needs to execute at an a priori unknown offset is arguably an improvement in any case, and given that the recent visibility changes allow the PIC build to pass with GCC as well, let's add -fpie for all arm64 builds rather than only for Clang. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Tested-by: Matthias Kaehlcke diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index f7425960f6a5..e078390ba477 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -10,7 +10,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ -fPIC -fno-strict-aliasing -mno-red-zone \ -mno-mmx -mno-sse -cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) +cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ -fno-builtin -fpic -mno-single-pic-base