From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@aquantia1com.onmicrosoft.com header.s=selector1-aquantia1com-onmicrosoft-com header.b=Anx+Hmpc; spf=pass (domain: aquantia.com, ip: 40.107.77.74, mailfrom: roman.agafonov@aquantia.com) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.77.74]) by groups.io with SMTP; Thu, 06 Jun 2019 05:20:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-AQUANTIA1COM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CMhxkqruo2lCTyFygxjN46u4ZdbOxW8OB/FOafZAmrE=; b=Anx+HmpcZ6r++YxbUTAf9DDcsT+ZMDPMr749dnldzNZA99Bua3i6s+z5wtIcd/mOvYv+J8vfbK9CiB0HovLbmeMS9Dp1nJqNfS5IGjjLL6okiJn4PLRukxWU1WWhTR92BG4X8HWWTJEbR4DBb1YGtm1jp9mWzdz2XQOwo1q9kSo= Received: from DM6PR11MB2955.namprd11.prod.outlook.com (20.177.217.28) by DM6PR11MB2891.namprd11.prod.outlook.com (20.177.216.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.14; Thu, 6 Jun 2019 12:20:07 +0000 Received: from DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::a06e:bee7:e6ee:3907]) by DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::a06e:bee7:e6ee:3907%7]) with mapi id 15.20.1943.023; Thu, 6 Jun 2019 12:20:07 +0000 From: Roman Agafonov To: "Gao, Liming" , "devel@edk2.groups.io" CC: "Feng, Bob C" , "Zhu, Yonghong" Subject: Re: [PATCH v1 1/1] BaseTools: don't use WHOLEARCHIVE linker flag for VS2017 toolchain Thread-Topic: [PATCH v1 1/1] BaseTools: don't use WHOLEARCHIVE linker flag for VS2017 toolchain Thread-Index: AQHVGuvztnZTUQXnBEyYuTMVWYDXF6aLpdiAgAAV+R+AAXplAIABSY5P Date: Thu, 6 Jun 2019 12:20:07 +0000 Message-ID: References: <20190604154059.30380-1-roman.agafonov@aquantia.com> <20190604154059.30380-2-roman.agafonov@aquantia.com>,<4A89E2EF3DFEDB4C8BFDE51014F606A14E46BAAE@SHSMSX104.ccr.corp.intel.com> ,<4A89E2EF3DFEDB4C8BFDE51014F606A14E46C5EF@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E46C5EF@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Roman.Agafonov@aquantia.com; x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 499ad482-2e7a-484c-03de-08d6ea795008 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:DM6PR11MB2891; x-ms-traffictypediagnostic: DM6PR11MB2891: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 00603B7EEF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(136003)(346002)(39850400004)(366004)(13464003)(189003)(199004)(316002)(86362001)(2906002)(110136005)(54906003)(26005)(6116002)(53546011)(2501003)(6506007)(99286004)(3846002)(7696005)(33656002)(76176011)(478600001)(4326008)(102836004)(6246003)(11346002)(446003)(476003)(486006)(71200400001)(71190400001)(9686003)(68736007)(66066001)(53936002)(5660300002)(186003)(14454004)(81166006)(81156014)(8676002)(256004)(14444005)(8936002)(74316002)(25786009)(229853002)(72206003)(7736002)(305945005)(66476007)(66556008)(66446008)(64756008)(55016002)(76116006)(66946007)(91956017)(6436002)(52536014)(19627235002)(73956011)(460985005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR11MB2891;H:DM6PR11MB2955.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: svZVSw5RnCochgJxn468i4BzaIXq1k79dUsi6JgOc0S7hQg2h2Kj24F1KfjtMdS1wX19ejUBLohSlEh6yTOYFDH0U6u8JUbWod6lk9Fn+MxzOCMi+OPsbUfF8ftaOTapIfa8j2VjoDoV2SOEE0OMmAAcSk9uyLYFrf61IB4BWwUJaxDEZdERDCTN+d4UI2eGdZhf8uV/lQC3bIhQRaykfnUyRA67hzJek7K5NrMoYLpzYsq20t/nDroXqz3m+YPZDb5OFIENwzD85SpL+IyOdtlyOfI7Ypcxb2wt67tDUzvu9ytF7FkKfwCCNyO9bC2XTRFfjQH9ylggt0ggpRkAZHKQoCpysEQoD4yxaLJAZB+JUlWiFUMFoLZn4szTa5s0SoPcv56s0h6kFGS9UM1ys3jsKT7EONVWbV2oNXGHawk= MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 499ad482-2e7a-484c-03de-08d6ea795008 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jun 2019 12:20:07.2999 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ragaf@aquantia.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2891 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Liming,=0A= =0A= I don't have any custom options except a few ones to disable compiler warni= ngs. AFAIK /GL is a compiler, not linker option, and it is used by EDK Visu= al Studio toolchains by default.=0A= =0A= Of course, the results may vary from project to project. There difference m= ay not be that big in all cases. Please try building some other package and= compare the results. For example, this is what I get for OptionRomPkg comp= iled with two different toolchains. As you can see, the difference in size = is abnormal.=0A= =0A= pcfist@pcfist-pc:/mnt/c/src/UEFI/UDK2018/Build/OptionRomPkg$ ls -psh1 RELEA= SE_VS2017/X64 RELEASE_VS2015x86/X64=0A= RELEASE_VS2015x86/X64:=0A= total 212K=0A= 20K AtapiPassThruDxe.efi=0A= 24K AtapiPassThruDxe.rom=0A= 28K Ax88772b.efi=0A= 24K Ax88772.efi=0A= 12K BltLibSample.efi=0A= 24K CirrusLogic5430Dxe.efi=0A= 12K CirrusLogic5430Dxe.rom=0A= 24K FtdiUsbSerialDxe.efi=0A= 0 MdePkg/=0A= 0 OptionRomPkg/=0A= 8.0K TOOLS_DEF.X64=0A= 36K UndiRuntimeDxe.efi=0A= =0A= RELEASE_VS2017/X64:=0A= total 424K=0A= 56K AtapiPassThruDxe.efi=0A= 56K AtapiPassThruDxe.rom=0A= 60K Ax88772b.efi=0A= 24K Ax88772.efi=0A= 12K BltLibSample.efi=0A= 56K CirrusLogic5430Dxe.efi=0A= 28K CirrusLogic5430Dxe.rom=0A= 56K FtdiUsbSerialDxe.efi=0A= 0 MdePkg/=0A= 0 OptionRomPkg/=0A= 8.0K TOOLS_DEF.X64=0A= 68K UndiRuntimeDxe.efi=0A= =0A= When comparing the .map files using difftool, I see a lot of unused functio= ns from edk2 libraries (such as UefiDevicePathLib etc.) being included in t= he resulting executable, thus increasing its size. This is exactly what /WH= OLEARCHIVE flag is intended for. My point here is whether this behavior is = really desired, and given the fact that WHOLEARCHIVE had been removed from = VS2015 toolchain previously, I don't see a reason to use it with VS2017 too= .=0A= =0A= Best regards,=0A= Roman=0A= =0A= =0A= From: Gao, Liming =0A= Sent: Wednesday, June 5, 2019 6:47 PM=0A= To: Roman Agafonov; devel@edk2.groups.io=0A= Cc: Feng, Bob C; Zhu, Yonghong=0A= Subject: RE: [PATCH v1 1/1] BaseTools: don't use WHOLEARCHIVE linker flag f= or VS2017 toolchain=0A= =A0=0A= I build edk2 OVMF with VS2015 and VS2017. Their image size are almost same.= Have you the additional options to disable the optimization? In fact, /GL = option will remove the unused function and logic.=0A= =0A= > -----Original Message-----=0A= > From: Roman Agafonov [mailto:Roman.Agafonov@aquantia.com]=0A= > Sent: Wednesday, June 5, 2019 1:21 AM=0A= > To: Gao, Liming ; devel@edk2.groups.io=0A= > Cc: Feng, Bob C ; Zhu, Yonghong =0A= > Subject: Re: [PATCH v1 1/1] BaseTools: don't use WHOLEARCHIVE linker flag= for VS2017 toolchain=0A= >=0A= > Hi Liming,=0A= >=0A= > Sure. Here is what I get after building our NIC driver binary with VS2015= x86 and VS2017 toolchains:=0A= >=0A= > pcfist@pcfist-pc:/mnt/c/src/uefi/udk2018$ du -h Build/xgbe_atl/RELEASE_VS= 2015x86/X64/xgbe_atl.efi=0A= > Build/xgbe_atl/RELEASE_VS2017/X64/xgbe_atl.efi=0A= > 36K =A0 =A0 Build/xgbe_atl/RELEASE_VS2015x86/X64/xgbe_atl.efi=0A= > 68K =A0 =A0 Build/xgbe_atl/RELEASE_VS2017/X64/xgbe_atl.efi=0A= >=0A= > Best regards,=0A= > Roman=0A= >=0A= > From: Gao, Liming =0A= > Sent: Tuesday, June 4, 2019 6:54 PM=0A= > To: Roman Agafonov; devel@edk2.groups.io=0A= > Cc: Feng, Bob C; Zhu, Yonghong=0A= > Subject: RE: [PATCH v1 1/1] BaseTools: don't use WHOLEARCHIVE linker flag= for VS2017 toolchain=0A= >=0A= > Can you show the size data with VS2017 and VS2015 for the same code?=0A= >=0A= > Thanks=0A= > Liming=0A= > > -----Original Message-----=0A= > > From: Roman Agafonov [mailto:Roman.Agafonov@aquantia.com]=0A= > > Sent: Tuesday, June 4, 2019 11:41 PM=0A= > > To: devel@edk2.groups.io=0A= > > Cc: Feng, Bob C ; Gao, Liming ; Zhu, Yonghong =0A= > > Subject: [PATCH v1 1/1] BaseTools: don't use WHOLEARCHIVE linker flag f= or VS2017 toolchain=0A= > >=0A= > > I have noticed the resulting binaries are about twice as large when=0A= > > using VS2017 toolchain compared to the ones built with VS2015. It appea= rs=0A= > > this is caused by /WHOLEARCHIVE linker flag used by this toolchain. Thi= s=0A= > > flag was previously removed from VS2015 toolchain due to compatibility= =0A= > > issues. I believe it should not be used with VS2017 as well.=0A= > >=0A= > > Cc: Bob Feng =0A= > > Cc: Liming Gao =0A= > > Cc: Yonghong Zhu =0A= > > Signed-off-by: Roman Agafonov =0A= > > ---=0A= > >=A0 BaseTools/Conf/tools_def.template | 2 +-=0A= > >=A0 1 file changed, 1 insertion(+), 1 deletion(-)=0A= > >=0A= > > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_d= ef.template=0A= > > index 26a2cf604f74..482a526f3052 100755=0A= > > --- a/BaseTools/Conf/tools_def.template=0A= > > +++ b/BaseTools/Conf/tools_def.template=0A= > > @@ -1545,7 +1545,7 @@ NOOPT_VS2015x86_X64_DLINK_FLAGS=A0=A0=A0 =3D /NOL= OGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF=0A= > >=A0 *_VS2017_*_APP_FLAGS=A0=A0=A0=A0=A0=A0 =3D /nologo /E /TC=0A= > >=A0 *_VS2017_*_PP_FLAGS=A0=A0=A0=A0=A0=A0=A0 =3D /nologo /E /TC /FIAutoG= en.h=0A= > >=A0 *_VS2017_*_VFRPP_FLAGS=A0=A0=A0=A0 =3D /nologo /E /TC /DVFRCOMPILE /= FI$(MODULE_NAME)StrDefs.h=0A= > > -*_VS2017_*_DLINK2_FLAGS=A0=A0=A0 =3D /WHOLEARCHIVE=0A= > > +*_VS2017_*_DLINK2_FLAGS=A0=A0=A0 =3D=0A= > >=A0 *_VS2017_*_ASM16_PATH=A0=A0=A0=A0=A0 =3D DEF(VS2017_BIN_IA32)\ml.exe= =0A= > >=0A= > >=A0 ##################=0A= > > --=0A= > > 2.9.0.windows.1=0A= =0A=