BaseTools: Made !ifdef-choice configurable on command line.

This commit is contained in:
Mikhail Krichanov 2023-03-14 09:57:47 +03:00 committed by MikhailKrichanov
parent adfdda5fca
commit 2a18a22be4
3 changed files with 10 additions and 13 deletions

View File

@ -20,9 +20,7 @@
IDENTIFIER = Default TOOL_CHAIN_CONF
# DEFINE MERGE_RODATA_INTO_TEXT =
!ifdef DEF(MERGE_RODATA_INTO_TEXT)
!ifdef $(MDEPKG_MERGE_RODATA_INTO_TEXT)
DEFINE DLINK_SCRIPT = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/Merge.lds
!else
DEFINE DLINK_SCRIPT = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/Base.lds

View File

@ -103,30 +103,30 @@ class ToolDefClassObject(object):
else:
EdkLogger.error("tools_def.txt parser", FILE_NOT_FOUND, ExtraData=FileName)
BranchPath = 0
Branch = 0
for Index in range(len(FileContent)):
Line = FileContent[Index].strip()
if Line == "" or Line[0] == '#':
continue
if Line.startswith("!ifdef"):
Branch = Line[6:].strip()
Done, Branch = self.ExpandMacros(Branch)
if Done:
BranchPath = 1
Condition = Line[6:].strip()
Reference = GlobalData.gMacroRefPattern.findall(Condition)
if Reference[0] in GlobalData.gCommandLineDefines:
Branch = 1
else:
BranchPath = -1
Branch = -1
continue
if Line.startswith("!else"):
BranchPath *= -1
Branch *= -1
continue
if Line.startswith("!endif"):
BranchPath = 0
Branch = 0
continue
if BranchPath == -1:
if Branch == -1:
continue
if Line.startswith("!include"):

View File

@ -33,5 +33,4 @@
MSFT:*_*_*_DLINK_FLAGS = /MERGE:.rdata=.text
CLANGPDB:*_*_*_DLINK_FLAGS = /MERGE:.rdata=.text
XCODE:*_*_*_DLINK_FLAGS = -rename_section __DATA_CONST __text_const __TEXT __const -rename_section __DATA_CONST __cstring __TEXT __cstring -rename_section __DATA_CONST __ustring __TEXT __ustring -rename_section __DATA_CONST __const __TEXT __data_const
# GCC/CLANGGCC: To enable this feature uncomment MERGE_RODATA_INTO_TEXT definition in tools_def.txt.
!endif