Skip to content

Commit a61ccb3

Browse files
committed
ArmVirt: move Defines section to new include file
The [Defines] section must be processed before including MdeLibs.dsc.inc so the correct stack cookie library can be picked. The other sections (especially [LibraryClasses]) should be processed afterwards so ArmVirt.dsc.inc can override the defaults choosen by MdeLibs.dsc.inc. Implement that by splitting the ArmVirt.dsc.inc include file into two, with the new file carrying the [Defines] section. Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent c6db764 commit a61ccb3

7 files changed

+45
-37
lines changed

ArmVirtPkg/ArmVirt.dsc.inc

-32
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,6 @@
88
#
99
#
1010

11-
[Defines]
12-
13-
#
14-
# Shell can be useful for debugging but should not be enabled for production
15-
#
16-
DEFINE BUILD_SHELL = TRUE
17-
18-
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
19-
20-
# Dynamic stack cookies pushes the FD size up slightly over 2MB
21-
!if $(TARGET) != NOOPT && $(ARCH) == ARM
22-
DEFINE FD_SIZE_IN_MB = 2
23-
!else
24-
DEFINE FD_SIZE_IN_MB = 3
25-
!endif
26-
27-
!if $(FD_SIZE_IN_MB) == 2
28-
DEFINE FD_SIZE = 0x200000
29-
DEFINE FD_NUM_BLOCKS = 0x200
30-
!endif
31-
!if $(FD_SIZE_IN_MB) == 3
32-
DEFINE FD_SIZE = 0x300000
33-
DEFINE FD_NUM_BLOCKS = 0x300
34-
!endif
35-
36-
# Dynamic stack cookies are not supported on ARM
37-
!if $(ARCH) == ARM
38-
DEFINE CUSTOM_STACK_CHECK_LIB = STATIC
39-
!else
40-
DEFINE CUSTOM_STACK_CHECK_LIB = DYNAMIC
41-
!endif
42-
4311
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
4412
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
4513

ArmVirtPkg/ArmVirtCloudHv.dsc

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
DEFINE SECURE_BOOT_ENABLE = FALSE
3030

3131
# This comes before MdeLibs to ensure stack cookie configuration is chosen
32-
!include ArmVirtPkg/ArmVirt.dsc.inc
32+
!include ArmVirtPkg/ArmVirtDefines.dsc.inc
3333

3434
[LibraryClasses.common]
3535
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
@@ -59,6 +59,7 @@
5959
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
6060

6161
!include MdePkg/MdeLibs.dsc.inc
62+
!include ArmVirtPkg/ArmVirt.dsc.inc
6263

6364
[LibraryClasses.common.PEIM]
6465
ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf

ArmVirtPkg/ArmVirtDefines.dsc.inc

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# SPDX-License-Identifier: BSD-2-Clause-Patent
3+
#
4+
5+
[Defines]
6+
7+
#
8+
# Shell can be useful for debugging but should not be enabled for production
9+
#
10+
DEFINE BUILD_SHELL = TRUE
11+
12+
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
13+
14+
# Dynamic stack cookies pushes the FD size up slightly over 2MB
15+
!if $(TARGET) != NOOPT && $(ARCH) == ARM
16+
DEFINE FD_SIZE_IN_MB = 2
17+
!else
18+
DEFINE FD_SIZE_IN_MB = 3
19+
!endif
20+
21+
!if $(FD_SIZE_IN_MB) == 2
22+
DEFINE FD_SIZE = 0x200000
23+
DEFINE FD_NUM_BLOCKS = 0x200
24+
!endif
25+
!if $(FD_SIZE_IN_MB) == 3
26+
DEFINE FD_SIZE = 0x300000
27+
DEFINE FD_NUM_BLOCKS = 0x300
28+
!endif
29+
30+
# Dynamic stack cookies are not supported on ARM
31+
!if $(ARCH) == ARM
32+
DEFINE CUSTOM_STACK_CHECK_LIB = STATIC
33+
!else
34+
DEFINE CUSTOM_STACK_CHECK_LIB = DYNAMIC
35+
!endif

ArmVirtPkg/ArmVirtKvmTool.dsc

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232

3333

3434
# This comes before MdeLibs to ensure stack cookie configuration is chosen
35-
!include ArmVirtPkg/ArmVirt.dsc.inc
35+
!include ArmVirtPkg/ArmVirtDefines.dsc.inc
3636

3737
!if $(ARCH) == AARCH64
3838
!include DynamicTablesPkg/DynamicTables.dsc.inc
3939
!endif
4040

4141
!include MdePkg/MdeLibs.dsc.inc
42+
!include ArmVirtPkg/ArmVirt.dsc.inc
4243

4344
[LibraryClasses.common]
4445
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf

ArmVirtPkg/ArmVirtQemu.dsc

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@
5252
!include NetworkPkg/NetworkDefines.dsc.inc
5353

5454
# This comes before MdeLibs to ensure stack cookie configuration is chosen
55-
!include ArmVirtPkg/ArmVirt.dsc.inc
55+
!include ArmVirtPkg/ArmVirtDefines.dsc.inc
5656

5757
!include MdePkg/MdeLibs.dsc.inc
58+
!include ArmVirtPkg/ArmVirt.dsc.inc
5859

5960
[LibraryClasses.common]
6061
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf

ArmVirtPkg/ArmVirtQemuKernel.dsc

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@
4949
!include NetworkPkg/NetworkDefines.dsc.inc
5050

5151
# This comes before MdeLibs to ensure stack cookie configuration is chosen
52-
!include ArmVirtPkg/ArmVirt.dsc.inc
52+
!include ArmVirtPkg/ArmVirtDefines.dsc.inc
5353

5454
!include MdePkg/MdeLibs.dsc.inc
55+
!include ArmVirtPkg/ArmVirt.dsc.inc
5556

5657
[LibraryClasses.common]
5758
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf

ArmVirtPkg/ArmVirtXen.dsc

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
FLASH_DEFINITION = ArmVirtPkg/ArmVirtXen.fdf
2525

2626
# This comes before MdeLibs to ensure stack cookie configuration is chosen
27-
!include ArmVirtPkg/ArmVirt.dsc.inc
27+
!include ArmVirtPkg/ArmVirtDefines.dsc.inc
2828

2929
!include MdePkg/MdeLibs.dsc.inc
30+
!include ArmVirtPkg/ArmVirt.dsc.inc
3031

3132
[LibraryClasses]
3233
SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.inf

0 commit comments

Comments
 (0)