From patchwork Tue Jun 12 15:23:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 138371 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5491511lji; Tue, 12 Jun 2018 08:24:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKII0iZD9lhdiqj5fCrpyG8nzSjgVBfEIeo1Gg3uIkMENNnSeGGxBKVmFi1c0pXwM5xJI2CO X-Received: by 2002:a17:902:543:: with SMTP id 61-v6mr906702plf.47.1528817063290; Tue, 12 Jun 2018 08:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528817063; cv=none; d=google.com; s=arc-20160816; b=J4a29r/huuWMQ57zUao1Lyweo313JFnbRQB2XN8q7XgmUdzsQ5GwQK2ddNaQh6en80 Mr/AGYKYvvIIs1iv/r1SubUe5bGoIfuIUg6uIlhXpRxaDjGxNaaHUNOxtWWXS3XHKO1o faQ9/LORApCVwTCi8nEQTstGCMqx9HzEw0ppbBPFKb8lMKvQcnZSmqsjspMMNEVpiE7U mLdqJjeAi6wA7SI2ZZrvq/Nbo/GKKCddaKXsx3F7KlbwLeaxB+QhPwncbF/IkGqqAUdH y7um94nDJFn9nRHDbxwJ8QrgxNVYeceuFz3cIvQ2G3aDdojcGsWbNXvIjvrcVEgaSzWJ BLLQ== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=jNm5P5JdYhg6LUZKYe7iUPA2413ArriGRN40n2s0Hjc=; b=f+Iiq4Fak3WGivUDD9E8Pv/A+sFURnt4uq9HwoYUvoWxbriIAY01TzFl6Wtr/OrWiA ks91jlyAjTgVQUq0iqYdaQbBz3YWB3RYeIDivpay1IExl6tWLIVfnfLrd5d2f76K+Jxs JaYUEt0JB75Vtq8QozhdLfCrQE9rOJylzY3r+JSFnEgjcvf+F3LTDciDsbpHu/khWzkc 9CircwBtmndHFq83ch3f8Mf5WcLh1iJWWTboW1onkPKF1f/rQ7rKG3gkhdwmOBLmXHcH DXIn5KLJBIiAfO2TxgMP7/uXRArHaUfXzVhlGQDmn54kbu8XYWf7TKefINqtNzfclOrh Quwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="fhsmiN/p"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id a73-v6si363629pfl.349.2018.06.12.08.24.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 08:24:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="fhsmiN/p"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 94DE721295CB2; Tue, 12 Jun 2018 08:23:42 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::22b; helo=mail-wm0-x22b.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7BE7E21295CB2 for ; Tue, 12 Jun 2018 08:23:41 -0700 (PDT) Received: by mail-wm0-x22b.google.com with SMTP id e16-v6so21288855wmd.0 for ; Tue, 12 Jun 2018 08:23:41 -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=l0vlCCucNOK9ayAX59EvpjIqjByCrKqyJoU8qyQROEs=; b=fhsmiN/p8/ZSGluUwKhHdFPEgvrnraqRh/qWjOUEOpNVMd7PuCi3B4dlfY2+xZPR8x D1UHB6cxaPDBMMLFe3qpAmutBRNul+HBS7BLWLI8BmCCoU/0w3TA3eodZiv8qs/ukMW5 4bFE/3B5komxkg5lizkvJXffPJhnzGZsJMQIM= 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=l0vlCCucNOK9ayAX59EvpjIqjByCrKqyJoU8qyQROEs=; b=AzCV/h9BIR/nharepxtrAIVLOWiTRawe+Z2d7mgc9k+jwEoFpLRgFAt81+7KtUV4FV +rC4grSWAQlifQWlPXYoCEAZGOon9PIoC9wlhOc2abOPZzdETI7YW57K4QWmyqTKdD+N bHDZ5bsuIJRh6V3GeSEXZKgkVzrPmRjswiWhKyfCjcwnxBqftZF/w5iGHphl9s64zI45 173QDmpQVOgMm1RNH7de8O+bOtSiaLugmImosRJlCZz28fwlbhw6Q1ZvGjthTu/AC1NJ 2nhcQ3FeE+otlAUcYfZR++qNQcqmoK0ihvlHJpW7eJIcK3skX+XZvo8AUOF0dc2d/MAo Z/3w== X-Gm-Message-State: APt69E2kKFaA+OqCy793ps5wtHp3FnFE1DxorV1E/E+fic0oL71etP0k /tTiVt1VAeSLsei9lViyDTpg0Kl5e+Q= X-Received: by 2002:a1c:3fc2:: with SMTP id m185-v6mr538995wma.37.1528817019694; Tue, 12 Jun 2018 08:23:39 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:3c84:18ae:27f2:d03]) by smtp.gmail.com with ESMTPSA id e2-v6sm500983wro.97.2018.06.12.08.23.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 08:23:38 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 12 Jun 2018 17:23:06 +0200 Message-Id: <20180612152306.25998-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612152306.25998-1-ard.biesheuvel@linaro.org> References: <20180612152306.25998-1-ard.biesheuvel@linaro.org> Subject: [edk2] [RFC PATCH 11/11] MdePkg/ProcessorBind.h X64: drop non-LTO limitation on visiblity override X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Ard Biesheuvel , Hao Wu , Jordan Justen , Andrew Fish , Leif Lindholm , Liming Gao , Zenith432 , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" When LTO is in effect, overriding the symbol visibility to 'hidden' using a GCC pragma used to result in module entry points being discarded, and along with them all other code in the binary. Now that we annotated all module entry points explicitly as having 'default' visibility, this is no longer the case, and we can drop this restriction. This prevents GCC's LTO code generator from emitting GOT based relocations that are non-trivial to deal with in GenFw. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/X64/ProcessorBind.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h index 38ef2665390f..7f78489bc2c4 100644 --- a/MdePkg/Include/X64/ProcessorBind.h +++ b/MdePkg/Include/X64/ProcessorBind.h @@ -27,18 +27,24 @@ #pragma pack() #endif -#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO) +#if defined(__GNUC__) && defined(__pic__) // // Mark all symbol declarations and references as hidden, meaning they will // not be subject to symbol preemption. This allows the compiler to refer to // symbols directly using relative references rather than via the GOT, which // contains absolute symbol addresses that are subject to runtime relocation. // -// The LTO linker will not emit GOT based relocations when all symbol -// references can be resolved locally, and so there is no need to set the -// pragma in that case (and doing so will cause other issues). -// #pragma GCC visibility push (hidden) + +// +// When LTO is in effect, symbols with hidden visibility will get discarded, +// since by definition, they cannot be referenced externally, even if they +// are the entry point of the executable. So we will have to change the +// visibility back to 'default' explicitly for all such entry points. +// +#ifdef USING_LTO +#define EFI_ENTRYPOINT __attribute__((__visibility__("default"))) +#endif #endif #if defined(__INTEL_COMPILER)