Previously, a linker rule was added to the ,dsc files to force section
alignment to 4096 bytes. This rule was wildcarded to apply to all GCC
builds. Unfortunately this only works for GCC/binutils that are targeted
for ELF. It doesn't work with UNIXGCC, because the MinGW version of the
GNU linker doesn't support the -z flag. The equivalent of
-z common-page-size=x for MinGW is to use --section-alignment=x and
--file-alignment=x.

The linker rules have been updated so that the existing -z option is
still applied for ELF GCC builds as before while an exception is used
for UNIXGCC so that it uses the equivalent PE flags instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bill Paul <[email protected]>
---
 OvmfPkg/OvmfPkgIa32.dsc    | 3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 ++-
 OvmfPkg/OvmfPkgX64.dsc     | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 737f300..765e0b6 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -46,7 +46,8 @@
   GCC:*_*_*_CC_FLAGS                   = -mno-mmx -mno-sse
 
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
-  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  GCC:*_UNIXGCC_*_DLINK_FLAGS = --section-alignment=0x1000 --file-
alignment=0x1000
+  GCC:*_GCC*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 
################################################################################
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 854cf6d..55fbce0 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -51,7 +51,8 @@
 !endif
 
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
-  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  GCC:*_UNIXGCC_*_DLINK_FLAGS = --section-alignment=0x1000 --file-
alignment=0x1000
+  GCC:*_GCC*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 
################################################################################
 #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 0cb2f60..5466bee 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -51,7 +51,8 @@
 !endif
 
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
-  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  GCC:*_UNIXGCC_*_DLINK_FLAGS = --section-alignment=0x1000 --file-
alignment=0x1000
+  GCC:*_GCC*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 
################################################################################
 #
-- 
2.4.6

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to