From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7BA5421A0292E for ; Thu, 25 May 2017 15:47:33 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 May 2017 15:47:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,393,1491289200"; d="scan'208";a="861390833" Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6]) by FMSMGA003.fm.intel.com with ESMTP; 25 May 2017 15:47:32 -0700 Received: from orsmsx153.amr.corp.intel.com (10.22.226.247) by ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 May 2017 15:47:32 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.59]) by ORSMSX153.amr.corp.intel.com ([169.254.12.150]) with mapi id 14.03.0319.002; Thu, 25 May 2017 15:47:32 -0700 From: "Kinney, Michael D" To: Laszlo Ersek , Ard Biesheuvel , "Andrew Fish (afish@apple.com)" , "Kinney, Michael D" CC: "Wu, Hao A" , "edk2-devel@lists.01.org" , "Fan, Jeff" Thread-Topic: [edk2] [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbol Thread-Index: AQHS1Bvps+cEwgPBI0yVHuet7kPBjKICn1nwgAEC8ICAADNMgP//3r4ggADGhwD//7lQ4IAAE0+AgAFn/4D//6JzgAAP0eKAAA6dj/D//63HgIAAStBw Date: Thu, 25 May 2017 22:47:31 +0000 Message-ID: References: <1495581673-10788-1-git-send-email-michael.d.kinney@intel.com> <60f3303b-c333-101d-b6e5-806ab85075a9@redhat.com> <435e1d65-7710-f548-c591-558307e266bc@redhat.com> <11d75cc7-1656-a31d-7dbf-dc7c176a9a88@redhat.com> In-Reply-To: <11d75cc7-1656-a31d-7dbf-dc7c176a9a88@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWU4ZjNiNDgtNTNmYS00NDE1LTk4MjMtMDRmMjhlY2I3ODcyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImhwZTJKWGUxR3Q5Y3N3S29HclFhbVBQRmh5VXNOcXRsN1Q3MVwvYmtnY2xJPSJ9 dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Subject: Re: [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 May 2017 22:47:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo, The other idea I have is for MSFT tool chains to do the DLINK step twice. = Once with /WHOLEARCHIVE set to a .dll that is not used in later steps, but the d= oing=20 the DLINK action detects duplicate symbols. If the first DLINK step passes, then so a second DLINK step to a .dll witho= ut=20 /WHOLEARCHIVE set and use this .dll to produce the .efi file that goes into= the=20 FW image. This 2 step link process would have the side effect of potentially increasi= ng=20 build times, but could be done for specific tool chain families in build_ru= les.txt. The first DLINK step could also disable a lot of the optimizations that tak= e=20 longer since the goal of this step is only to detect a duplicate symbol. Best regards, Mike > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of La= szlo > Ersek > Sent: Thursday, May 25, 2017 1:11 PM > To: Kinney, Michael D ; Ard Biesheuvel > ; Andrew Fish (afish@apple.com) > Cc: Wu, Hao A ; edk2-devel@lists.01.org; Fan, Jeff > > Subject: Re: [edk2] [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix > duplicate symbol >=20 > On 05/25/17 21:57, Kinney, Michael D wrote: > > Laszlo, > > > > I have the same concern on final image sizes. I have done some > > evaluation: > > > > GCC5 OVMF X64 DEBUG without -whole-archive > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > FV Space Information > > SECFV [19%Full] 212992 total, 42000 used, 170992 free > > FVMAIN_COMPACT [33%Full] 3440640 total, 1162760 used, 2277880 free > > DXEFV [38%Full] 10485760 total, 4024024 used, 6461736 free > > PEIFV [19%Full] 917504 total, 180648 used, 736856 free > > Total used =3D 5409432 > > > > GCC5 OVMF X64 DEBUG with -whole-archive > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > FV Space Information > > SECFV [19%Full] 212992 total, 41936 used, 171056 free > > FVMAIN_COMPACT [33%Full] 3440640 total, 1158304 used, 2282336 free > > DXEFV [38%Full] 10485760 total, 4029656 used, 6456104 free > > PEIFV [19%Full] 917504 total, 181352 used, 736152 free > > Total used =3D 5411248 > > > > Total used difference =3D 1816 bytes larger with -whole-archive > > > > I was also able to do a MSFT VS2015 build with /WHOLEARCHIVE set > > and it also catches the same duplicate symbol error now. > > > > error C2220: warning treated as error - no 'executable' file generated > > warning C4744: 'mMemoryDiscoveredNotifyList' has different type in > 'd:\work\github\tianocore\edk2\mdemodulepkg\core\dxeiplpeim\dxeload.c' an= d > 'd:\work\github\tianocore\edk2\sourceleveldebugpkg\library\debugagent\sec= peidebug > agent\secpeidebugagentlib.c': 'struct (12 bytes)' and 'array (12 bytes)' > > DxeIpl.lib(DxeLoad.obj) : error LNK2005: _mMemoryDiscoveredNotifyList a= lready > defined in SecPeiDebugAgentLib.lib(SecPeiDebugAgentLib.obj) > > > d:\work\github\tianocore\edk2\Build\OvmfIa32\DEBUG_VS2015x86\IA32\MdeModu= lePkg\Co > re\DxeIplPeim\DxeIpl\DEBUG\DxeIpl.dll : fatal error LNK1169: one or more = multiply > defined symbols found > > > > VS2015 OVMF X64 DEBUG without /WHOLEARCHIVE > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > FV Space Information > > SECFV [22%Full] 212992 total, 48560 used, 164432 free > > FVMAIN_COMPACT [33%Full] 3440640 total, 1147464 used, 2293176 free > > DXEFV [39%Full] 10485760 total, 4163888 used, 6321872 free > > PEIFV [22%Full] 917504 total, 204840 used, 712664 free > > Total used =3D 5564752 > > > > > > VS2015 OVMF X64 DEBUG with /WHOLEARCHIVE > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > FV Space Information > > SECFV [23%Full] 212992 total, 50384 used, 162608 free > > FVMAIN_COMPACT [33%Full] 3440640 total, 1147424 used, 2293216 free > > DXEFV [42%Full] 10485760 total, 4422992 used, 6062768 free > > PEIFV [27%Full] 917504 total, 255528 used, 661976 free > > Total used =3D 5875338 > > > > Total used difference =3D 310586 bytes larger with /WHOLEARCHIVE > > > > For tool chains that do have size impacts, one option is to > > have a "test" build that enables the linker flags to detect > > duplicate symbols. For example the following could be added > > to a DSC file. May want to disable GenFds stage when doing > > this type of build. > > > > [BuildOptions] > > !ifdef $(DETECT_DUPLICATE_SYMBOLS) > > MSFT:*_VS2015_*_DLINK_FLAGS =3D /WHOLEARCHIVE > > !endif >=20 > Thank you (again) for the research! Looks like the gcc size impact is > friendly enough to keep --whole-archive enabled at all times (possibly > due to the --gc-sections flag mentioned by Ard, which we already have > enabled). >=20 > The VS2015 impact is really large however. >=20 > I was hoping we could add these flags to > "BaseTools/Conf/tools_def.template", regardless of platform DSC. (If the > flag is non-default, and/or it's platform-dependent, then it will almost > never be used, most likely.) But the VS2015 size increase really > precludes /WHOLEARCHIVE (for the MSFT family) from "tools_def.template". >=20 > Would it be acceptable to add --whole-archive to "tools_def.template" > only for GCC? After all, at the moment only XCODE*/XCLANG have "-all_load= ". >=20 > Thanks, > Laszlo > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel