回复: [edk2-devel] [PATCH v7 1/3] BaseTools: Remove COMMON section from the GCC discard list


gaoliming
 

Ard:
Chris explains this change in https://edk2.groups.io/g/devel/message/77662. And, he also verifies the patch in OVMF with GCC5 tool chain.

Thanks
Liming

-----邮件原件-----
发件人: Ard Biesheuvel <ardb@kernel.org>
发送时间: 2021年8月4日 20:27
收件人: Yao, Jiewen <jiewen.yao@intel.com>
抄送: devel@edk2.groups.io; christopher.zurcher@outlook.com; Feng, Bob C
<bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
主题: Re: [edk2-devel] [PATCH v7 1/3] BaseTools: Remove COMMON section
from the GCC discard list

On Wed, 21 Jul 2021 at 13:44, Yao, Jiewen <jiewen.yao@intel.com> wrote:

Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
I don't think this is a good idea tbh. We have already identified that
EDK2 code often fails to use the STATIC keyword when possible for
global variables, and that unrelated variables that happen to have the
same name will be collapsed into the same storage unit in the program
image. (see commit 214a3b79417f64bf2faae74af42c1b9d23f50dc8 for
details)

Was this considered? Is this no longer an issue?



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
Christopher
Zurcher
Sent: Wednesday, July 21, 2021 6:07 AM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb@kernel.org>; Feng, Bob C
<bob.c.feng@intel.com>;
Liming Gao <gaoliming@byosoft.com.cn>
Subject: [edk2-devel] [PATCH v7 1/3] BaseTools: Remove COMMON
section
from the GCC discard list

From: Christopher Zurcher <christopher.zurcher@microsoft.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2507

The COMMON section is used by OpenSSL assembly-optimized crypto
functions. OpenSSL assembly code is auto-generated from the submodule
and cannot be modified to remove dependence on the COMMON section.
The default -fno-common compiler flag should still prevent variable from
being emitted into the COMMON section.

Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
---
BaseTools/Scripts/GccBase.lds | 1 -
1 file changed, 1 deletion(-)

diff --git a/BaseTools/Scripts/GccBase.lds
b/BaseTools/Scripts/GccBase.lds
index a9dd2138d4..83cebd29d5 100644
--- a/BaseTools/Scripts/GccBase.lds
+++ b/BaseTools/Scripts/GccBase.lds
@@ -74,6 +74,5 @@ SECTIONS {
*(.dynamic)
*(.hash .gnu.hash)
*(.comment)
- *(COMMON)
}
}
--
2.32.0.windows.1