From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (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 7E87E1A1E6B for ; Mon, 1 Aug 2016 23:21:27 -0700 (PDT) Received: by mail-it0-x22a.google.com with SMTP id f6so263673087ith.1 for ; Mon, 01 Aug 2016 23:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uZi1RMFR+SQ09tSgHL9lgYaT3+ah8QYFWjseSmN/zno=; b=koUUjJE2SfRfIiX89X2d3093hMC6s7B6KgCU1FcysSblF3xbuZX14zpO94uEQdRAI1 /n2LwOYf9A1kKRzV3JNMo4N/5CtrapiU1YZNcpPOp8z67Kl253tMZrrxTcbqPHr8AGXA iov3h7oAwcgSqEMSMNMyKSdJnInetOCXmlEVs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uZi1RMFR+SQ09tSgHL9lgYaT3+ah8QYFWjseSmN/zno=; b=mSq1hoo34MVYCiBj/OhTWMOvB9p7gVU94uErkEcv/5kvWyvw0USxauU8UXlKEgg7Wc dIXL8XBHWSb8G1MNUa+eEgYX75ccLsW8b+olWaQSPHIXGwu03PsBKOwKeIBSsoWWlX4V bm7DQx8TqnGpkWXAHRwLPhEoSLGpSXj33gRR2NEZzE69uF0EI4r+gR4dodSMseYXRZRr 7zvli6at4IeIyI9CQORRF9wM2jODGEmvx8C8CuxBPXOKlLgomvsWOQ1ueHjroKFFJsPQ 1HxLBFpaFyvdRTpMwjQUne9IWme+ggClpEghpLzzPXo4u1A3KkiBhTkJNTULzZJqFUXP 59+Q== X-Gm-Message-State: AEkoous+dWqjKiBsV51PKyek5NGOQIWo+4N7HI6tS5V3zBf2KhuFLFHBfUCA0k/zMUrW27uDVCWPN4UAQpA1SqsQ X-Received: by 10.36.86.134 with SMTP id o128mr65155290itb.5.1470118886736; Mon, 01 Aug 2016 23:21:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.204.195 with HTTP; Mon, 1 Aug 2016 23:21:26 -0700 (PDT) In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A1155E3E3A@shsmsx102.ccr.corp.intel.com> References: <1470034640-3912-1-git-send-email-ard.biesheuvel@linaro.org> <4A89E2EF3DFEDB4C8BFDE51014F606A1155E3E3A@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Tue, 2 Aug 2016 08:21:26 +0200 Message-ID: To: "Gao, Liming" Cc: "Shi, Steven" , "Zhu, Yonghong" , "Justen, Jordan L" , "edk2-devel@lists.01.org" Subject: Re: [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: , X-List-Received-Date: Tue, 02 Aug 2016 06:21:27 -0000 Content-Type: text/plain; charset=UTF-8 On 2 August 2016 at 04:49, Gao, Liming wrote: > Reviewed-by: Liming Gao > Thanks Pushed as 28ade7b802e0 -- Ard. >> -----Original Message----- >> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >> Sent: Monday, August 01, 2016 2:57 PM >> To: Shi, Steven ; Zhu, Yonghong >> ; Gao, Liming ; Justen, >> Jordan L ; edk2-devel@lists.01.org >> Cc: Ard Biesheuvel >> Subject: [PATCH] MdePkg: move to 'hidden' visibility for all symbols under >> GCC/X64 >> >> 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(-) >> >> 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) >> -- >> 2.7.4 >