Some gnu linkers used with GCC44, such as GNU ld 2.19.1, require a
--defsym= command line option to precede the --script= option in
order for the definition to be available for use by the script.
Move the --defsym= command line option to satisfy this requirement
and avoid a GCC44 build failure.  

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <sc...@notabs.org>
---

I found this using a Windows hosted GCC 4.4.7 and Shell build:
build.exe -p d:\edk2build\edk2\ShellPkg\ShellPkg.dsc -b DEBUG -t GCC44 -n 16 -a 
X64
"ld" -o 
d:\edk2build\edk2\Build\Shell\DEBUG_GCC44\X64\ShellPkg\Application\Shell\Shell\DEBUG\Shell.dll
 -nostdlib -n -q --gc-sections -z common-page-size=0x20 --entry 
_ModuleEntryPoint -u _ModuleEntryPoint -Map 
d:\edk2build\edk2\Build\Shell\DEBUG_GCC44\X64\ShellPkg\Application\Shell\Shell\DEBUG/Shell.map
 -melf_x86_64 --oformat=elf64-x86-64 --start-group  
@d:\edk2build\edk2\Build\Shell\DEBUG_GCC44\X64\ShellPkg\Application\Shell\Shell\OUTPUT\static_library_files.lst
 --end-group --script=d:\edk2build\edk2\basetools/Scripts/GccBase.lds 
--defsym=PECOFF_HEADER_SIZE=0x228
d:\edk2build\edk2\basetools/Scripts/GccBase.lds:1: undefined symbol 
`PECOFF_HEADER_SIZE' referenced in expression
---

 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 eeb488f..806e6e6 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3850,9 +3850,9 @@ DEFINE GCC44_X64_CC_FLAGS            = 
DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-p
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections -z 
common-page-size=0x20
 DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC44_IA32_X64_DLINK_FLAGS    = DEF(GCC44_IA32_X64_DLINK_COMMON) 
--entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC44_IA32_DLINK2_FLAGS       = DEF(GCC_DLINK2_FLAGS_COMMON) 
--defsym=PECOFF_HEADER_SIZE=0x220
+DEFINE GCC44_IA32_DLINK2_FLAGS       = --defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_X64_DLINK_FLAGS         = DEF(GCC44_IA32_X64_DLINK_FLAGS)  
-melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC44_X64_DLINK2_FLAGS        = DEF(GCC_DLINK2_FLAGS_COMMON) 
--defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC44_X64_DLINK2_FLAGS        = --defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_ASM_FLAGS               = DEF(GCC_ASM_FLAGS)
 
 DEFINE GCC45_IA32_CC_FLAGS           = DEF(GCC44_IA32_CC_FLAGS)

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to