From patchwork Mon Aug 1 06:57:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 73080 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp2544511qga; Sun, 31 Jul 2016 23:57:29 -0700 (PDT) X-Received: by 10.66.21.167 with SMTP id w7mr93103477pae.62.1470034649322; Sun, 31 Jul 2016 23:57:29 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id y21si33601831pfb.140.2016.07.31.23.57.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Jul 2016 23:57:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; 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 edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 92FB51A1E12; Sun, 31 Jul 2016 23:57:28 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (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 9F1411A1E11 for ; Sun, 31 Jul 2016 23:57:27 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id q128so357215570wma.1 for ; Sun, 31 Jul 2016 23:57:27 -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; bh=n90edvK9Qf0uWFO2w0CoimnnXn1vFEFjVvSVvgjLsJA=; b=CfeolE1MC9VbhRFAClpFNpLAyH1dmd7djrmd011pY8oX6FMM6GnKUkuYSgWpYIMrg5 0x8zxdhg+Kx+CLmf41JrnvWbgJOLFmXj6WB3EAdOZFWjy91Izxqj/qDEPDvf7Q34AGe9 OLbrfsaIZUgYAE6VwSuxFynd74uppj4hOeBJc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=n90edvK9Qf0uWFO2w0CoimnnXn1vFEFjVvSVvgjLsJA=; b=BqF4C9Cye7US4zp6U6WHo9u99MQrC5BN29d7RskXryjzqIaj49AZGBFXK4MA7J0kp/ 9tta9bMtTZmPrUDkqp/I2qxyi3LNqXXU677RgOTZ1pwDlcv2A2P/TUL374ASztM/Z5II SputuWR11/92omvkGP3TlUnZa3LzVxniGRJclt3yKtkZbHrOOpT+1/vOdzrAII7cVspj YFqsFEr87IezzzTaT8pQEbqmnI0IUTlSyaT9ERAwiXC4bQtIcnr7GihonOzMiSIqPKSA SN3DrfcI+q6opXK8Hm0c0akLNT8eiDiw1NrRuR/I7s9UYNdRkZpwQeAmoiQhp9TLJT7c sf0g== X-Gm-Message-State: AEkoouuY4ynthUHzZ++GgGTA2E3z1h1EFp58wjU/R0Mqp7KidgzGXFVTLl5I5SEw+cVMIYKv X-Received: by 10.194.77.97 with SMTP id r1mr52796162wjw.83.1470034645579; Sun, 31 Jul 2016 23:57:25 -0700 (PDT) Received: from localhost.localdomain (3.red-81-34-118.dynamicip.rima-tde.net. [81.34.118.3]) by smtp.gmail.com with ESMTPSA id b186sm15398821wmg.23.2016.07.31.23.57.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 31 Jul 2016 23:57:24 -0700 (PDT) From: Ard Biesheuvel To: steven.shi@intel.com, yonghong.zhu@intel.com, liming.gao@intel.com, jordan.l.justen@intel.com, edk2-devel@lists.01.org Date: Mon, 1 Aug 2016 08:57:20 +0200 Message-Id: <1470034640-3912-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdePkg: move to 'hidden' visibility for all symbols under GCC/X64 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" When using GCC to build for X64, we switched to the position independent small code model, which is much more efficient in terms of code generation and runtime relocation footprint, and produces binaries that can execute correctly from any offset. However, the PIC routines are by default geared towards hosted binaries containing symbol references that may resolve to definitions in other dynamic objects, and for this reason, external symbol references are indirected via a GOT entry by default (which also results in a .reloc fixup entry) unless we annotate them. For this reason, we introduced the 'protected' visibility annotation for all symbol definitions and references, by setting the GCC visibility pragma. However, as it turns out, this is not sufficient for all versions of GCC, and in some cases (GCC 5.x using the GCC49 toolchain tag), may still result in GOT based relocations. So switch to 'hidden' visibility instead, which is slightly stronger, and fixes this issue for the versions of GCC that exhibit the problem. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/X64/ProcessorBind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 _______________________________________________ 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 a4aad3e524e8..666cc8e8bd16 100644 --- a/MdePkg/Include/X64/ProcessorBind.h +++ b/MdePkg/Include/X64/ProcessorBind.h @@ -29,12 +29,12 @@ #if defined(__GNUC__) && defined(__pic__) // -// Mark all symbol declarations and references as protected, meaning they will +// 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. // -#pragma GCC visibility push (protected) +#pragma GCC visibility push (hidden) #endif #if defined(__INTEL_COMPILER)