From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: liming.gao@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Sat, 28 Sep 2019 23:32:29 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2019 23:32:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,562,1559545200"; d="scan'208";a="202527034" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 28 Sep 2019 23:32:28 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 28 Sep 2019 23:32:28 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 28 Sep 2019 23:32:27 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.206]) with mapi id 14.03.0439.000; Sun, 29 Sep 2019 14:32:26 +0800 From: "Liming Gao" To: "Yao, Jiewen" , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [Patch 09/12] CryptoPkg IntrinsicLib: Make _fltused always be used Thread-Topic: [edk2-devel] [Patch 09/12] CryptoPkg IntrinsicLib: Make _fltused always be used Thread-Index: AQHVdQfVuJNVyYlryECi8Vnk50+tV6c/Mo5QgAMAuJA= Date: Sun, 29 Sep 2019 06:32:25 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E50CFA1@SHSMSX104.ccr.corp.intel.com> References: <1569570395-11240-1-git-send-email-liming.gao@intel.com> <1569570395-11240-10-git-send-email-liming.gao@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503F7CCA59@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503F7CCA59@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 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jiewen: When CLANG9 is used, CLANG compiler always removes _fltused symbol, and = cause the linker issue.=20 __attribute__((used)) variable attribute informs the compiler that a stat= ic variable is to be retained in the object file, even if it is unreference= d. So, I add this attribute for _fltused symbol and let compiler keep this s= ymbol for linker. I find GCC and CLANG both supports this attribute. Then, = I add it for GCC and CLANG both.=20 Thanks Liming >-----Original Message----- >From: Yao, Jiewen >Sent: Friday, September 27, 2019 4:34 PM >To: devel@edk2.groups.io; Gao, Liming >Subject: RE: [edk2-devel] [Patch 09/12] CryptoPkg IntrinsicLib: Make _flt= used >always be used > >Hi > >+int GLOBAL_USED _fltused =3D 1; > >May I know what is the use of GLOBAL_USED? Only for compiler stub symbol? > >If so, why we add __GNUC__ here? Any other usage? > >+#if defined(__GNUC__) || defined(__clang__) >+ #define GLOBAL_USED __attribute__((used)) >+#else >+ #define GLOBAL_USED >+#endif > >> -----Original Message----- >> From: devel@edk2.groups.io On Behalf Of Liming >Gao >> Sent: Friday, September 27, 2019 3:47 PM >> To: devel@edk2.groups.io >> Subject: [edk2-devel] [Patch 09/12] CryptoPkg IntrinsicLib: Make _fltus= ed >always >> be used >> >> With this change, global variable _fltused will not be removed by LTO >> >> Signed-off-by: Liming Gao >> --- >> CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c >> b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c >> index 6e4d4a68cc..94fe341bec 100644 >> --- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c >> +++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c >> @@ -2,7 +2,7 @@ >> Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based >> Cryptographic Library. >> >> -Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
>> +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
>> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> @@ -13,9 +13,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >> >> typedef UINTN size_t; >> >> +#if defined(__GNUC__) || defined(__clang__) >> + #define GLOBAL_USED __attribute__((used)) >> +#else >> + #define GLOBAL_USED >> +#endif >> + >> /* OpenSSL will use floating point support, and C compiler produces th= e >_fltused >> symbol by default. Simply define this symbol here to satisfy the li= nker. */ >> -int _fltused =3D 1; >> +int GLOBAL_USED _fltused =3D 1; >> >> /* Sets buffers to a specified character */ >> void * memset (void *dest, int ch, size_t count) >> -- >> 2.13.0.windows.1 >> >> >>=20