From nobody Mon Sep 16 19:16:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152881705705817.016401183574317; Tue, 12 Jun 2018 08:24:17 -0700 (PDT) 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) 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) 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) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.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 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-Google-Smtp-Source: ADUXVKIgH7Y/FP28dbRu0SJUtwwKgmzQ/oyBsJvG3wsLw18t/xEhjSskw2x0NL3ZkRGj62TCltB+cw== X-Received: by 2002:a1c:3fc2:: with SMTP id m185-v6mr538995wma.37.1528817019694; Tue, 12 Jun 2018 08:23:39 -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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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(-) diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/Proces= sorBind.h index 38ef2665390f..7f78489bc2c4 100644 --- a/MdePkg/Include/X64/ProcessorBind.h +++ b/MdePkg/Include/X64/ProcessorBind.h @@ -27,18 +27,24 @@ #pragma pack() #endif =20 -#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, whi= ch // contains absolute symbol addresses that are subject to runtime relocati= on. // -// 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 discarde= d, +// 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 =20 #if defined(__INTEL_COMPILER) --=20 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel