From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 F0B7421E2BE59 for ; Sun, 27 Aug 2017 20:25:32 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2017 20:28:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,439,1498546800"; d="scan'208";a="1211223828" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 27 Aug 2017 20:28:11 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 27 Aug 2017 20:28:08 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 27 Aug 2017 20:28:08 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.39]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Mon, 28 Aug 2017 11:27:50 +0800 From: "Gao, Liming" To: Laszlo Ersek , Ard Biesheuvel CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Enable --whole-archive in GCC tool chain as the default option Thread-Index: AQHTHKKDPUg7wzB6lkWt5VKkZGZ5naKUWn+AgAAAjgCAABWqAIAEq+Lg Date: Mon, 28 Aug 2017 03:27:49 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D78139F@shsmsx102.ccr.corp.intel.com> References: <1503556125-7024-1-git-send-email-liming.gao@intel.com> <2cf820ad-4a6d-648e-560b-d223bef9b45d@redhat.com> In-Reply-To: <2cf820ad-4a6d-648e-560b-d223bef9b45d@redhat.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] BaseTools: Enable --whole-archive in GCC tool chain as the default option 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: Mon, 28 Aug 2017 03:25:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo: I will update the patch with your comments.=20 Ard:=20 We collect the size impact in Ovmf platform. Its impact is small. So, my = patch enable this option for all targets. Below is the data collected on Ov= mfIa32X64.dsc with GCC5 tool chain. Raw image is a little bigger. But, the = compressed size is a little smaller.=20 PEIFV 178472 --> 179176 +704 (Bytes) DXEFV 4062512 --> 4075056 +12544 (Bytes) FVMAIN_COMPACT 1190896 --> 1184920 -5976 (Bytes) Thanks Liming >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Laszlo Ersek >Sent: Friday, August 25, 2017 7:48 PM >To: Ard Biesheuvel >Cc: edk2-devel@lists.01.org; Gao, Liming >Subject: Re: [edk2] [Patch] BaseTools: Enable --whole-archive in GCC tool >chain as the default option > >On 08/25/17 12:30, Ard Biesheuvel wrote: >> On 25 August 2017 at 11:28, Laszlo Ersek wrote: >>> On 08/24/17 08:28, Liming Gao wrote: >>>> https://bugzilla.tianocore.org/show_bug.cgi?id=3D581 >>> >>> (1) I suggest adding one sentence (before you push the patch): >>> >>> "The --whole-archive linker option helps us catch multiply defined >symbols." >>> >>>> Contributed-under: TianoCore Contribution Agreement 1.1 >>>> Signed-off-by: Liming Gao >>>> Cc: Yonghong Zhu >>>> --- >>>> BaseTools/Conf/tools_def.template | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/BaseTools/Conf/tools_def.template >b/BaseTools/Conf/tools_def.template >>>> index 24956e4..a85afd5 100755 >>>> --- a/BaseTools/Conf/tools_def.template >>>> +++ b/BaseTools/Conf/tools_def.template >>>> @@ -4377,7 +4377,7 @@ DEFINE GCC44_IA32_CC_FLAGS =3D >DEF(GCC44_ALL_CC_FLAGS) -m32 -march=3Di586 >>>> DEFINE GCC44_X64_CC_FLAGS =3D DEF(GCC44_ALL_CC_FLAGS) -m64 >-fno-stack-protector "-DEFIAPI=3D__attribute__((ms_abi))" -maccumulate- >outgoing-args -mno-red-zone -Wno-address -mcmodel=3Dsmall -fpie -fno- >asynchronous-unwind-tables >>>> DEFINE GCC44_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-n,-q,--gc- >sections -z common-page-size=3D0x20 >>>> DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS =3D >DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u >ReferenceAcpiTable >>>> -DEFINE GCC44_IA32_X64_DLINK_FLAGS =3D >DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,-- >entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,- >Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map >>>> +DEFINE GCC44_IA32_X64_DLINK_FLAGS =3D >DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,-- >entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,- >Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive >>>> DEFINE GCC44_IA32_DLINK2_FLAGS =3D -Wl,-- >defsym=3DPECOFF_HEADER_SIZE=3D0x220 DEF(GCC_DLINK2_FLAGS_COMMON) >>>> DEFINE GCC44_X64_DLINK_FLAGS =3D >DEF(GCC44_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=3Delf64-x86- >64 >>>> DEFINE GCC44_X64_DLINK2_FLAGS =3D -Wl,-- >defsym=3DPECOFF_HEADER_SIZE=3D0x228 DEF(GCC_DLINK2_FLAGS_COMMON) >>>> @@ -4457,7 +4457,7 @@ DEFINE GCC49_IA32_CC_FLAGS =3D >DEF(GCC48_IA32_CC_FLAGS) >>>> DEFINE GCC49_X64_CC_FLAGS =3D DEF(GCC48_X64_CC_FLAGS) >>>> DEFINE GCC49_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-n,-q,--gc- >sections -z common-page-size=3D0x40 >>>> DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS =3D >DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u >ReferenceAcpiTable >>>> -DEFINE GCC49_IA32_X64_DLINK_FLAGS =3D >DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,-- >entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,- >Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map >>>> +DEFINE GCC49_IA32_X64_DLINK_FLAGS =3D >DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,-- >entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,- >Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive >>>> DEFINE GCC49_IA32_DLINK2_FLAGS =3D >DEF(GCC48_IA32_DLINK2_FLAGS) >>>> DEFINE GCC49_X64_DLINK_FLAGS =3D >DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=3Delf64-x86- >64 >>>> DEFINE GCC49_X64_DLINK2_FLAGS =3D >DEF(GCC48_X64_DLINK2_FLAGS) >>>> >>> >>> This patch doesn't apply directly on current master, due to context >>> differences introduced by 2f7f1e73c10f ("BaseTools: Add the missing -pi= e >>> link option in GCC tool chain", 2017-08-23). >>> >>> However, it does apply to the parent of 2f7f1e73c10f, and from there it >>> can be rebased without manual conflict resolution. >>> >>> I did just that, and tested the patch with GCC48, IA32, IA32X64, and X6= 4 >>> OVMF. It works for me: >>> >>> Tested-by: Laszlo Ersek >>> >>> (2) If Ard agrees, can you please post a similar patch for ARM/AARCH64, >>> GCC? (I think that should be a separate patch, so that I don't have to >>> re-test the IA32/X64 change.) >>> >> >> Didn't we decide this should be DEBUG/NOOPT only, due to code size >increase? > >I didn't remember off-hand, but I found this in my mailbox: > >http://mid.mail-archive.com/df25cbe5-a6a0-79d5-ccd7- >f0ad53c2ed03@redhat.com > >On 05/26/17 11:05, Laszlo Ersek wrote: >> - GCC toolchains: I think I'd like --whole-archive to become the >> default (regardless of build target), since there don't seem to be >> any relevant size costs to it. > >Up-thread, Mike wrote "Total used difference =3D 1816 bytes larger with >-whole-archive". > >Nonetheless, if we want to be super cautious, I don't mind if RELEASE >doesn't get --whole-archive. > >Thanks, >Laszlo >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel