Fixes problems due to code assuming it runs with frame pointers and thus
updates rbp / ebp registers when switching stacks.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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 73f95b2a3a9f..f1fd6a003062 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1888,8 +1888,8 @@ DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
-DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
+DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
--
2.38.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96729): https://edk2.groups.io/g/devel/message/96729
Mute This Topic: https://groups.io/mt/95354912/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Gerd,
Sorry, gotta ask: does this make much difference in the size of the
compiled code? That's a constraint on many real-hardware X64 platforms,
especially for 32-bit code.
Brian J. Johnson
-------- Original Message --------
From: Gerd Hoffmann [mailto:kraxel@redhat.com]
Sent: Wednesday, November 30, 2022 at 3:44 AM
To: devel@edk2.groups.io
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>, Liming Gao
<gaoliming@byosoft.com.cn>, Erdem Aktas <erdemaktas@google.com>, Pawel
Polawski <ppolawsk@redhat.com>, Jordan Justen
<jordan.l.justen@intel.com>, Ard Biesheuvel <ardb+tianocore@kernel.org>,
Yuwei Chen <yuwei.chen@intel.com>, Tom Lendacky
<thomas.lendacky@amd.com>, James Bottomley <jejb@linux.ibm.com>, Gerd
Hoffmann <kraxel@redhat.com>, Oliver Steffen <osteffen@redhat.com>,
Jiewen Yao <jiewen.yao@intel.com>, Min Xu <min.m.xu@intel.com>, Brijesh
Singh <brijesh.singh@amd.com>, Bob Feng <bob.c.feng@intel.com>
Subject: [edk2-devel] [PATCH v7 2/2] tools_def: add
-fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS
Fixes problems due to code assuming it runs with frame pointers and thus
updates rbp / ebp registers when switching stacks.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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 73f95b2a3a9f..f1fd6a003062 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1888,8 +1888,8 @@ DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS)
-ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib
-Wl,-n,-q,--gc-sections -z common-page-size=0x20
-DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32
-march=i586 -malign-double -fno-stack-protector -D EFI32
-fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))"
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small
-fpie -fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32
-march=i586 -malign-double -fno-stack-protector -D EFI32
-fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
+DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))"
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small
-fpie -fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS =
DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u
ReferenceAcpiTable
DEFINE GCC48_IA32_X64_DLINK_FLAGS =
DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u
$(IMAGE_ENTRY_POINT)
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
DEFINE GCC48_IA32_DLINK2_FLAGS =
-Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
--
Brian
--------------------------------------------------------------------
"I love deadlines. I like the whooshing sound they make as they fly by."
-- Douglas Adams
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96746): https://edk2.groups.io/g/devel/message/96746
Mute This Topic: https://groups.io/mt/95354912/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
On Wed, Nov 30, 2022 at 01:28:42PM -0600, Brian J. Johnson wrote: > Gerd, > > Sorry, gotta ask: does this make much difference in the size of the > compiled code? That's a constraint on many real-hardware X64 platforms, > especially for 32-bit code. Quick test with OvmfPkg/OvmfPkgIa32X64.dsc (sec/pei ia32, dxe x64): master branch: FV Space Information SECFV [11%Full] 212992 (0x34000) total, 23728 (0x5cb0) used, 189264 (0x2e350) free PEIFV [34%Full] 917504 (0xe0000) total, 319416 (0x4dfb8) used, 598088 (0x92048) free DXEFV [49%Full] 12582912 (0xc00000) total, 6268032 (0x5fa480) used, 6314880 (0x605b80) free FVMAIN_COMPACT [98%Full] 1753088 (0x1ac000) total, 1725328 (0x1a5390) used, 27760 (0x6c70) free with patch applied: FV Space Information SECFV [11%Full] 212992 (0x34000) total, 23728 (0x5cb0) used, 189264 (0x2e350) free PEIFV [34%Full] 917504 (0xe0000) total, 319416 (0x4dfb8) used, 598088 (0x92048) free DXEFV [50%Full] 12582912 (0xc00000) total, 6335936 (0x60adc0) used, 6246976 (0x5f5240) free FVMAIN_COMPACT [99%Full] 1753088 (0x1ac000) total, 1738176 (0x1a85c0) used, 14912 (0x3a40) free So slightly more for 64-bit code. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96819): https://edk2.groups.io/g/devel/message/96819 Mute This Topic: https://groups.io/mt/95354912/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
OK. Doesn't look like a big impact.
Thanks,
Brian J. Johnson
-------- Original Message --------
From: Gerd Hoffmann [mailto:kraxel@redhat.com]
Sent: Thursday, December 1, 2022 at 2:38 AM
To: Brian J. Johnson <brian.johnson@hpe.com>
Cc: devel@edk2.groups.io, Alexey Kardashevskiy <aik@ozlabs.ru>, Liming
Gao <gaoliming@byosoft.com.cn>, Erdem Aktas <erdemaktas@google.com>,
Pawel Polawski <ppolawsk@redhat.com>, Jordan Justen
<jordan.l.justen@intel.com>, Ard Biesheuvel <ardb+tianocore@kernel.org>,
Yuwei Chen <yuwei.chen@intel.com>, Tom Lendacky
<thomas.lendacky@amd.com>, James Bottomley <jejb@linux.ibm.com>, Oliver
Steffen <osteffen@redhat.com>, Jiewen Yao <jiewen.yao@intel.com>, Min Xu
<min.m.xu@intel.com>, Brijesh Singh <brijesh.singh@amd.com>, Bob Feng
<bob.c.feng@intel.com>
Subject: [edk2-devel] [PATCH v7 2/2] tools_def: add
-fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS
On Wed, Nov 30, 2022 at 01:28:42PM -0600, Brian J. Johnson wrote:
> Gerd,
>
> Sorry, gotta ask: does this make much difference in the size of the
> compiled code? That's a constraint on many real-hardware X64 platforms,
> especially for 32-bit code.
Quick test with OvmfPkg/OvmfPkgIa32X64.dsc (sec/pei ia32, dxe x64):
master branch:
FV Space Information
SECFV [11%Full] 212992 (0x34000) total, 23728 (0x5cb0) used, 189264
(0x2e350) free
PEIFV [34%Full] 917504 (0xe0000) total, 319416 (0x4dfb8) used, 598088
(0x92048) free
DXEFV [49%Full] 12582912 (0xc00000) total, 6268032 (0x5fa480) used,
6314880 (0x605b80) free
FVMAIN_COMPACT [98%Full] 1753088 (0x1ac000) total, 1725328 (0x1a5390)
used, 27760 (0x6c70) free
with patch applied:
FV Space Information
SECFV [11%Full] 212992 (0x34000) total, 23728 (0x5cb0) used, 189264
(0x2e350) free
PEIFV [34%Full] 917504 (0xe0000) total, 319416 (0x4dfb8) used, 598088
(0x92048) free
DXEFV [50%Full] 12582912 (0xc00000) total, 6335936 (0x60adc0) used,
6246976 (0x5f5240) free
FVMAIN_COMPACT [99%Full] 1753088 (0x1ac000) total, 1738176 (0x1a85c0)
used, 14912 (0x3a40) free
So slightly more for 64-bit code.
take care,
Gerd
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96837): https://edk2.groups.io/g/devel/message/96837
Mute This Topic: https://groups.io/mt/95354912/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Gerd:
I have no comments for this change. Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Brian J.
> Johnson
> 发送时间: 2022年12月2日 0:18
> 收件人: devel@edk2.groups.io; kraxel@redhat.com
> 抄送: Alexey Kardashevskiy <aik@ozlabs.ru>; Liming Gao
> <gaoliming@byosoft.com.cn>; Erdem Aktas <erdemaktas@google.com>;
> Pawel Polawski <ppolawsk@redhat.com>; Jordan Justen
> <jordan.l.justen@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Yuwei Chen <yuwei.chen@intel.com>; Tom Lendacky
> <thomas.lendacky@amd.com>; James Bottomley <jejb@linux.ibm.com>;
> Oliver Steffen <osteffen@redhat.com>; Jiewen Yao <jiewen.yao@intel.com>;
> Min Xu <min.m.xu@intel.com>; Brijesh Singh <brijesh.singh@amd.com>; Bob
> Feng <bob.c.feng@intel.com>
> 主题: Re: [edk2-devel] [PATCH v7 2/2] tools_def: add
> -fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS
>
> OK. Doesn't look like a big impact.
>
> Thanks,
> Brian J. Johnson
> -------- Original Message --------
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Thursday, December 1, 2022 at 2:38 AM
> To: Brian J. Johnson <brian.johnson@hpe.com>
> Cc: devel@edk2.groups.io, Alexey Kardashevskiy <aik@ozlabs.ru>, Liming
> Gao <gaoliming@byosoft.com.cn>, Erdem Aktas <erdemaktas@google.com>,
> Pawel Polawski <ppolawsk@redhat.com>, Jordan Justen
> <jordan.l.justen@intel.com>, Ard Biesheuvel <ardb+tianocore@kernel.org>,
> Yuwei Chen <yuwei.chen@intel.com>, Tom Lendacky
> <thomas.lendacky@amd.com>, James Bottomley <jejb@linux.ibm.com>,
> Oliver
> Steffen <osteffen@redhat.com>, Jiewen Yao <jiewen.yao@intel.com>, Min Xu
> <min.m.xu@intel.com>, Brijesh Singh <brijesh.singh@amd.com>, Bob Feng
> <bob.c.feng@intel.com>
> Subject: [edk2-devel] [PATCH v7 2/2] tools_def: add
> -fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS
>
> On Wed, Nov 30, 2022 at 01:28:42PM -0600, Brian J. Johnson wrote:
> > Gerd,
> >
> > Sorry, gotta ask: does this make much difference in the size of the
> > compiled code? That's a constraint on many real-hardware X64 platforms,
> > especially for 32-bit code.
>
> Quick test with OvmfPkg/OvmfPkgIa32X64.dsc (sec/pei ia32, dxe x64):
>
> master branch:
>
> FV Space Information
> SECFV [11%Full] 212992 (0x34000) total, 23728 (0x5cb0) used, 189264
> (0x2e350) free
> PEIFV [34%Full] 917504 (0xe0000) total, 319416 (0x4dfb8) used, 598088
> (0x92048) free
> DXEFV [49%Full] 12582912 (0xc00000) total, 6268032 (0x5fa480) used,
> 6314880 (0x605b80) free
> FVMAIN_COMPACT [98%Full] 1753088 (0x1ac000) total, 1725328 (0x1a5390)
> used, 27760 (0x6c70) free
>
> with patch applied:
>
> FV Space Information
> SECFV [11%Full] 212992 (0x34000) total, 23728 (0x5cb0) used, 189264
> (0x2e350) free
> PEIFV [34%Full] 917504 (0xe0000) total, 319416 (0x4dfb8) used, 598088
> (0x92048) free
> DXEFV [50%Full] 12582912 (0xc00000) total, 6335936 (0x60adc0) used,
> 6246976 (0x5f5240) free
> FVMAIN_COMPACT [99%Full] 1753088 (0x1ac000) total, 1738176 (0x1a85c0)
> used, 14912 (0x3a40) free
>
> So slightly more for 64-bit code.
>
> take care,
> Gerd
>
>
>
>
>
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97053): https://edk2.groups.io/g/devel/message/97053
Mute This Topic: https://groups.io/mt/95507700/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.