From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 5C8311A1E10 for ; Mon, 1 Aug 2016 22:26:59 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 01 Aug 2016 22:26:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,458,1464678000"; d="scan'208";a="1018028037" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 01 Aug 2016 22:26:59 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 1 Aug 2016 22:26:58 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 1 Aug 2016 22:26:58 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.147]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.181]) with mapi id 14.03.0248.002; Tue, 2 Aug 2016 13:26:56 +0800 From: "Gao, Liming" To: "Gao, Liming" , Ard Biesheuvel CC: "Justen, Jordan L" , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" , "lersek@redhat.com" , "Gao, Liming" Thread-Topic: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points Thread-Index: AQHR68sX1YXE81CPpEGCgS3W14qzHaAz3ajA///MjYCAAAH5gIAAD02AgAAFr4CAATU1gIAAAisQ Date: Tue, 2 Aug 2016 05:26:55 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A1155E3F4F@shsmsx102.ccr.corp.intel.com> References: <1470038497-2536-1-git-send-email-ard.biesheuvel@linaro.org> <1470038497-2536-8-git-send-email-ard.biesheuvel@linaro.org> <4A89E2EF3DFEDB4C8BFDE51014F606A1155E30DE@shsmsx102.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A1155E3E28@shsmsx102.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A1155E3E28@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points 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 05:26:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ard: This update works. It is better. For my question, I get the answer from y= our previous patch. Please ignore it.=20 =20 Patches 3&4&6&8 are good to me. Reviewed-by: Liming Gao Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Gao, Liming > Sent: Tuesday, August 02, 2016 10:39 AM > To: Ard Biesheuvel > Cc: Justen, Jordan L ; edk2-devel@lists.01.org= ; > leif.lindholm@linaro.org; lersek@redhat.com > Subject: Re: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibil= ity > for module entry points >=20 > Ard: > I will verify it. And, I would ask why only X64 requires it? IA32, ARM = and > AARCH64 doesn't specially handle it? >=20 > Thanks > Liming > > -----Original Message----- > > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > > Sent: Tuesday, August 02, 2016 12:12 AM > > To: Gao, Liming > > Cc: Shi, Steven ; Zhu, Yonghong > > ; Justen, Jordan L ; > > edk2-devel@lists.01.org; lersek@redhat.com; leif.lindholm@linaro.org > > Subject: Re: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' > visibility > > for module entry points > > > > On 1 August 2016 at 17:51, Ard Biesheuvel > > wrote: > > > On 1 August 2016 at 16:56, Ard Biesheuvel > > wrote: > > >> On 1 August 2016 at 16:49, Ard Biesheuvel > > wrote: > > >>> On 1 August 2016 at 16:18, Gao, Liming wrote= : > > >>>> Ard: > > >>>> I don't think it is good way to define GCC_VISIBILITY_PROTECTED > and > > apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It > has > > been specified in LINK_FLAGS in tools_def.txt. Could we also specify it= s > > attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt? > > >>>> > > >>> > > >>> It seems this does the trick as well > > >>> > > >>> diff --git a/BaseTools/Scripts/GccBase.lds > > b/BaseTools/Scripts/GccBase.lds > > >>> index 281af8a9bd33..02387d4f8d6f 100644 > > >>> --- a/BaseTools/Scripts/GccBase.lds > > >>> +++ b/BaseTools/Scripts/GccBase.lds > > >>> @@ -80,3 +80,7 @@ SECTIONS { > > >>> *(COMMON) > > >>> } > > >>> } > > >>> + > > >>> +VERSION { > > >>> + { global: _ModuleEntryPoint*; }; > > >>> +}; > > >>> > > >>> > > >>> Note that * at the end: this is necessary since _ModuleEntryPoint w= ill > > >>> be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects. > > >>> > > >> > > >> Hmm, looks like I spoke too soon. I don't know what I did wrong, but > > >> this does not actually work. > > >> > > > > > > The only alternative I can think of is to add a static non-lto object > > > to the tree that refers to _ModuleEntryPoint, similar to the way I > > > handle the ARM intrinsics in patch #5 > > > > > > > As it turns out, the LTO linker does not need to visibility pragma to > > prevent it from emitting GOT based relocations. This makes sense, > > considering that the LTO linker can see that no symbol references are > > ever satisfied across dynamic object boundaries. That means I could > > work around this in the following way: > > > > diff --git a/BaseTools/Conf/tools_def.template > > b/BaseTools/Conf/tools_def.template > > index 314adaf6bfa8..983e2fea7390 100644 > > --- a/BaseTools/Conf/tools_def.template > > +++ b/BaseTools/Conf/tools_def.template > > @@ -4462,7 +4462,7 @@ DEFINE GCC49_ARM_ASLDLINK_FLAGS =3D > > DEF(GCC48_ARM_ASLDLINK_FLAGS) > > DEFINE GCC49_AARCH64_ASLDLINK_FLAGS =3D > > DEF(GCC48_AARCH64_ASLDLINK_FLAGS) > > > > DEFINE GCC5_IA32_CC_FLAGS =3D DEF(GCC49_IA32_CC_FLAGS) -flt= o > > -fno-builtin > > -DEFINE GCC5_X64_CC_FLAGS =3D DEF(GCC49_X64_CC_FLAGS) -flto > > -fno-builtin > > +DEFINE GCC5_X64_CC_FLAGS =3D DEF(GCC49_X64_CC_FLAGS) -flto > > -fno-builtin -DUSING_LTO > > DEFINE GCC5_IA32_X64_DLINK_COMMON =3D > > DEF(GCC49_IA32_X64_DLINK_COMMON) > > DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS =3D > > DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) > > DEFINE GCC5_IA32_X64_DLINK_FLAGS =3D > > DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto > > diff --git a/MdePkg/Include/X64/ProcessorBind.h > > b/MdePkg/Include/X64/ProcessorBind.h > > index 666cc8e8bd16..77fab7055afc 100644 > > --- a/MdePkg/Include/X64/ProcessorBind.h > > +++ b/MdePkg/Include/X64/ProcessorBind.h > > @@ -27,12 +27,15 @@ > > #pragma pack() > > #endif > > > > -#if defined(__GNUC__) && defined(__pic__) > > +#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO) > > // > > // Mark all symbol declarations and references as hidden, meaning they > will > > // not be subject to symbol preemption. This allows the compiler to re= fer > 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 anyway, so there= is > no > > +// need to set the pragma in that case (and doing so will cause issues= of its > > +// own) > > // > > #pragma GCC visibility push (hidden) > > #endif > > > > and I can drop this patch. > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel