From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web10.47549.1680238423994055507 for ; Thu, 30 Mar 2023 21:53:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=kAR139/A; spf=pass (domain: byosoft.com.cn, ip: 114.80.218.36, mailfrom: gaoliming@byosoft.com.cn) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id A37FCA32E024 for ; Fri, 31 Mar 2023 12:53:40 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1680238420; bh=64M2txJijOUj8nfNmcKmxndgvnilQ9RmywJrmGwqauM=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=kAR139/Acbw3QMHULdiQNxiNKPXG2NtohnVTRYGD1jnFCcbKKRKevQC37DYruAz8s BNAnMqxrwzgJPTukqtGKHylRU/HPZxs9hkLGQbLtdhmgTXexN1BUP3H0c4rGWbGV0v CpOjM8kYBG215lE4yOuG0DOh2RNUn0KilLm3va+c= Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 9239DA32E003 for ; Fri, 31 Mar 2023 12:53:40 +0800 (CST) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 2F740A32DFE1 for ; Fri, 31 Mar 2023 12:53:40 +0800 (CST) Authentication-Results: zrleap.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id A5671A32DFEC for ; Fri, 31 Mar 2023 12:53:37 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 31 Mar 2023 12:53:20 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: , , , , , References: <023601d96137$7e714bb0$7b53e310$@byosoft.com.cn> <23BF58B2-BF1C-442D-A988-B0A8A1174CEA@posteo.de> In-Reply-To: <23BF58B2-BF1C-442D-A988-B0A8A1174CEA@posteo.de> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIDIvM10gQmFzZVRvb2xzL0NvbmYvdG9vbHNfZGVmOiBGaXggQ0xBTkdEV0FSRl9JQTMyX1g2NA==?= Date: Fri, 31 Mar 2023 12:53:20 +0800 Message-ID: <024401d9638c$b73deb40$25b9c1c0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJQil0+queZDuiJhnb6Wg79rYAdIgGTSNR5rhlj0tA= Sender: "gaoliming" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Marvin: Platform developer can decide how to configure this option in their DSC fi= le to resolve their problem. This is one option for the platform developer.= =20 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Marvin > H?user > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B43=E6=9C=8828=E6=97=A5 = 19:26 > =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming > =E6=8A=84=E9=80=81: devel@edk2.groups.io; patrick.rudolph@9elements.com; > guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com; > ray.ni@intel.com; ardb@kernel.org > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def= : Fix > CLANGDWARF_IA32_X64 >=20 > Hi all, >=20 > > On 28. Mar 2023, at 07:38, gaoliming wrote: > > =EF=BB=BFPatrick: > > I prefer to override this option in DSC instead of the change in > > tools_def.txt. >=20 > A DSC override to fix *binary corruption* of an unknown cause? It is ridi= culous > this can even happen silently, even though it=E2=80=99s unclear which com= ponent is at > fault. >=20 > > Normal EFI image needs to set its page size for the smaller > > image size. > > > > You can see GCC DLINK option. It also sets page-size as 0x40. > > > > DEFINE GCC49_IA32_X64_DLINK_COMMON =3D -nostdlib > -Wl,-n,-q,--gc-sections -z > > common-page-size=3D0x40 >=20 > Side note, the correct way to do this is setting max-page-size, not > common-page-size. >=20 > > > > Thanks > > Liming > >> -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > >> =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =E4=BB=A3=E8=A1=A8 Patrick > >> Rudolph > >> =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B43=E6=9C=8817=E6=97= =A5 22:06 > >> =E6=8A=84=E9=80=81: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@= intel.com; > >> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de; > >> ardb@kernel.org > >> =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def:= Fix > >> CLANGDWARF_IA32_X64 > >> > >> Drop the "-z max-page-size=3D0x40" option as it causes the ELF > >> header to overflow into the .text section, causing undefined > >> behaviour. >=20 > That *definitely* is not a fix. Not only does this regress binary size fo= r > platforms that have tight SPI space constraints, it also only masks the i= ssue. In > the (frankly near-impossible) case the ELF header dramatically grows in s= ize, > who knows whether it can overflow again? >=20 > Sorry, but the overall description is pretty vague. Which OS / compiler v= ersion > are you using? Do you have any trivial way to detect the corruption? I ne= ver > really touched UefiPayloadPkg and have nothing set up to boot it to repro= duce > the issue. >=20 > Best regards, > Marvin >=20 > >> > >> With high optimization level it corrupts essential code and > >> the binary would crash. It might work with low optimization > >> level though. As the default is to use Oz and LTO, it always > >> crashes. > >> > >> Test: > >> The ELF generated by > >> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots. > >> > >> Signed-off-by: Patrick Rudolph > >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4357 > >> --- > >> BaseTools/Conf/tools_def.template | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/BaseTools/Conf/tools_def.template > >> b/BaseTools/Conf/tools_def.template > >> index 9b59bd75c3..0c584ab390 100755 > >> --- a/BaseTools/Conf/tools_def.template > >> +++ b/BaseTools/Conf/tools_def.template > >> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =3D > >> ENV(CLANG_BIN) > >> > >> > >> # LLVM/CLANG doesn't support -n link option. So, it can't share the sa= me > >> IA32_X64_DLINK_COMMON flag. > >> > >> # LLVM/CLANG doesn't support common page size. So, it can't share the > >> same GccBase.lds script. > >> > >> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib > >> -Wl,-q,--gc-sections -z max-page-size=3D0x40 > >> > >> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib > >> -Wl,-q,--gc-sections > >> > >> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =3D > >> -Wl,--script=3D$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds > >> > >> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =3D > >> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) > >> -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0 > >> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) > >> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable > >> > >> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =3D > >> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) > >> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) > >> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive > >> > >> -- > >> 2.39.1 > >> > >> > >> > >> -=3D-=3D-=3D-=3D-=3D-=3D > >> Groups.io Links: You receive all messages sent to this group. > >> View/Reply Online (#101341): > >> https://edk2.groups.io/g/devel/message/101341 > >> Mute This Topic: https://groups.io/mt/97673649/4905953 > >> Group Owner: devel+owner@edk2.groups.io > >> Unsubscribe: https://edk2.groups.io/g/devel/unsub > >> [gaoliming@byosoft.com.cn] > >> -=3D-=3D-=3D-=3D-=3D-=3D >=20 >=20 >=20 >=20 >=20