Sync EDKII BaseTools to BaseTools project r1928

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10234 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2010-03-12 10:54:01 +00:00
parent b7250b714a
commit 636f2be673
29 changed files with 262 additions and 134 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -131,6 +131,10 @@
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src} "$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
"$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst} "$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
<Command.ARMGCC>
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
[C-Header-File] [C-Header-File]
<InputFile> <InputFile>
*.h, *.H *.h, *.H
@ -215,7 +219,7 @@
<Command.RVCT> <Command.RVCT>
"$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST) "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
<Command.RVCTCYGWIN> <Command.RVCTCYGWIN, Command.ARMGCC>
# $(OBJECT_FILES_LIST) has wrong paths for cygwin # $(OBJECT_FILES_LIST) has wrong paths for cygwin
"$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES) "$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)
@ -239,6 +243,9 @@
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS) "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
<Command.ARMGCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -) $(DLINK2_FLAGS)
<Command.RVCT> <Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
@ -266,6 +273,9 @@
<Command.GCC> <Command.GCC>
"$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
<Command.ARMGCC>
"$(DLINK)" $(DLINK_FLAGS) -( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -) $(DLINK2_FLAGS)
<Command.RVCT> <Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
@ -284,7 +294,7 @@
<OutputFile> <OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME).efi $(DEBUG_DIR)(+)$(MODULE_NAME).efi
<Command.MSFT, Command.INTEL, Command.RVCT> <Command.MSFT, Command.INTEL, Command.RVCT, Command.ARMGCC>
GenFw -e $(MODULE_TYPE) -o ${dst} ${src} GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
$(CP) ${dst} $(OUTPUT_DIR) $(CP) ${dst} $(OUTPUT_DIR)
$(CP) ${dst} $(BIN_DIR) $(CP) ${dst} $(BIN_DIR)

View File

@ -140,8 +140,8 @@ DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Develope
DEFINE RVCT31_TOOLS_PATH = c:/Program Files/ARM/RVCT/Programs/3.1/761/win_32-pentium DEFINE RVCT31_TOOLS_PATH = c:/Program Files/ARM/RVCT/Programs/3.1/761/win_32-pentium
DEFINE RVCT31CYGWIN_TOOLS_PATH = /cygdrive/c/Program Files/ARM/RVCT/Programs/3.1/761/win_32-pentium DEFINE RVCT31CYGWIN_TOOLS_PATH = /cygdrive/c/Program Files/ARM/RVCT/Programs/3.1/761/win_32-pentium
# Update to the location of the gcc executables DEFINE SOURCERY_TOOLS = c:/Program Files/CodeSourcery/Sourcery G++ Lite/bin
DEFINE ARMGCC_BIN = / DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin
#################################################################################### ####################################################################################
# #
@ -1589,8 +1589,8 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_UNIXGCC_*_MAKE_PATH = make *_UNIXGCC_*_MAKE_PATH = make
*_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN) *_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
*_UNIXGCC_IA32_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) *_UNIXGCC_IA32_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) --image-base=0
*_UNIXGCC_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) *_UNIXGCC_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) --image-base=0
*_UNIXGCC_IA32_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS) *_UNIXGCC_IA32_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
*_UNIXGCC_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS) *_UNIXGCC_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
*_UNIXGCC_*_ASM_FLAGS = DEF(GCC_ASM_FLAGS) *_UNIXGCC_*_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
@ -1717,8 +1717,8 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_CYGGCC_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe *_CYGGCC_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe
*_CYGGCC_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN) *_CYGGCC_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
*_CYGGCC_IA32_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) *_CYGGCC_IA32_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) --image-base=0
*_CYGGCC_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) *_CYGGCC_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) --image-base=0
*_CYGGCC_IA32_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS) *_CYGGCC_IA32_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
*_CYGGCC_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS) *_CYGGCC_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
*_CYGGCC_*_MAKE_FLAGS = /nologo *_CYGGCC_*_MAKE_FLAGS = /nologo
@ -1745,10 +1745,11 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_CYGGCC_IA32_ASLPP_PATH = DEF(CYGWIN_BINIA32)gcc *_CYGGCC_IA32_ASLPP_PATH = DEF(CYGWIN_BINIA32)gcc
*_CYGGCC_IA32_ASLDLINK_PATH = DEF(CYGWIN_BINIA32)ld *_CYGGCC_IA32_ASLDLINK_PATH = DEF(CYGWIN_BINIA32)ld
*_CYGGCC_IA32_RC_PATH = DEF(CYGWIN_BINIA32)objcopy *_CYGGCC_IA32_RC_PATH = DEF(CYGWIN_BINIA32)objcopy
*_CYGGCC_IA32_OBJECT_PATH = DEF(CYGWIN_BINIA32)objcopy *_CYGGCC_IA32_OBJCOPY_PATH = DEF(CYGWIN_BINIA32)objcopy
*_CYGGCC_IA32_CC_FLAGS = DEF(GCC_IA32_CC_FLAGS) *_CYGGCC_IA32_CC_FLAGS = DEF(GCC_IA32_CC_FLAGS)
*_CYGGCC_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_CYGGCC_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_CYGGCC_IA32_OBJCOPY_FLAGS =
################## ##################
# X64 definitions # X64 definitions
@ -1764,10 +1765,11 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_CYGGCC_X64_ASLPP_PATH = DEF(CYGWIN_BINX64)gcc *_CYGGCC_X64_ASLPP_PATH = DEF(CYGWIN_BINX64)gcc
*_CYGGCC_X64_ASLDLINK_PATH = DEF(CYGWIN_BINX64)ld *_CYGGCC_X64_ASLDLINK_PATH = DEF(CYGWIN_BINX64)ld
*_CYGGCC_X64_RC_PATH = DEF(CYGWIN_BINX64)objcopy *_CYGGCC_X64_RC_PATH = DEF(CYGWIN_BINX64)objcopy
*_CYGGCC_X64_OBJECT_PATH = DEF(CYGWIN_BINX64)objcopy *_CYGGCC_X64_OBJCOPY_PATH = DEF(CYGWIN_BINX64)objcopy
*_CYGGCC_X64_CC_FLAGS = DEF(GCC_X64_CC_FLAGS) *_CYGGCC_X64_CC_FLAGS = DEF(GCC_X64_CC_FLAGS)
*_CYGGCC_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_CYGGCC_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_CYGGCC_X64_OBJCOPY_FLAGS =
################## ##################
# IPF definitions # IPF definitions
@ -1784,7 +1786,6 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_CYGGCC_IPF_OBJCOPY_PATH = DEF(CYGWIN_BINIPF)objcopy *_CYGGCC_IPF_OBJCOPY_PATH = DEF(CYGWIN_BINIPF)objcopy
*_CYGGCC_IPF_SYMRENAME_PATH = DEF(CYGWIN_BINIPF)objcopy *_CYGGCC_IPF_SYMRENAME_PATH = DEF(CYGWIN_BINIPF)objcopy
*_CYGGCC_IPF_RC_PATH = DEF(CYGWIN_BINIPF)objcopy *_CYGGCC_IPF_RC_PATH = DEF(CYGWIN_BINIPF)objcopy
*_CYGGCC_IPF_OBJECT_PATH = DEF(CYGWIN_BINIPF)objcopy
*_CYGGCC_IPF_CC_FLAGS = DEF(GCC_IPF_CC_FLAGS) *_CYGGCC_IPF_CC_FLAGS = DEF(GCC_IPF_CC_FLAGS)
*_CYGGCC_IPF_DLINK_FLAGS = DEF(GCC_IPF_DLINK_FLAGS) *_CYGGCC_IPF_DLINK_FLAGS = DEF(GCC_IPF_DLINK_FLAGS)
@ -2839,13 +2840,16 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM
#################################################################################### ####################################################################################
# #
# ARM GCC (GCC 4.1.1, etc.) # ARM GCC (www.codesourcery.com)
# #
#################################################################################### ####################################################################################
# ARMGCC - ARM version of the GCC cross compiler # ARMGCC - ARM version of the GCC cross compiler
*_ARMGCC_*_*_FAMILY = GCC *_ARMGCC_*_*_FAMILY = GCC
*_ARMGCC_*_MAKE_PATH = make *_ARMGCC_*_*_BUILDRULEFAMILY = ARMGCC
*_ARMGCC_*_MAKE_PATH = DEF(SOURCERY_TOOLS)/cs-make
*_ARMGCC_*_MAKE_FLAGS = --no-print-directory
################## ##################
# ASL definitions # ASL definitions
@ -2861,24 +2865,24 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM
# ARM definitions # ARM definitions
################## ##################
*_ARMGCC_ARM_ASLCC_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc *_ARMGCC_ARM_ASLCC_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc
*_ARMGCC_ARM_ASLDLINK_PATH = DEF(ARMGCC_BIN)/arm-elf-ld *_ARMGCC_ARM_ASLDLINK_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-ld
*_ARMGCC_ARM_ASLPP_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc *_ARMGCC_ARM_ASLPP_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc
*_ARMGCC_ARM_CC_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc *_ARMGCC_ARM_CC_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc
*_ARMGCC_ARM_SLINK_PATH = DEF(ARMGCC_BIN)/arm-elf-ar *_ARMGCC_ARM_SLINK_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-ar
*_ARMGCC_ARM_DLINK_PATH = DEF(ARMGCC_BIN)/arm-elf-ld *_ARMGCC_ARM_DLINK_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-ld
*_ARMGCC_ARM_ASM_PATH = DEF(ARMGCC_BIN)/arm-elf-as *_ARMGCC_ARM_ASM_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-as
*_ARMGCC_ARM_PP_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc *_ARMGCC_ARM_PP_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc
*_ARMGCC_ARM_VFRPP_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc *_ARMGCC_ARM_VFRPP_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc
# #
# Use default values, or override in DSC file # Use default values, or override in DSC file
# #
*_ARMGCC_ARM_ARCHCC_FLAGS = *_ARMGCC_ARM_ARCHCC_FLAGS = -march=armv7-a -mthumb
*_ARMGCC_ARM_ARCHASM_FLAGS = *_ARMGCC_ARM_ARCHASM_FLAGS = -march=armv7-a
*_ARMGCC_ARM_ARCHDLINK_FLAGS = *_ARMGCC_ARM_ARCHDLINK_FLAGS =
*_ARMGCC_ARM_PLATFORM_FLAGS = *_ARMGCC_ARM_PLATFORM_FLAGS = -march=armv7-a
DEBUG_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian -g DEBUG_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian -g
RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian
@ -2886,11 +2890,12 @@ RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian
*_ARMGCC_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h *_ARMGCC_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
*_ARMGCC_ARM_MAKE_PATH = make *_ARMGCC_ARM_SLINK_FLAGS = -rc
*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --oformat=elf32-littlearm -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_ARMGCC_ARM_SLINK_FLAGS = -r #
*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --emit-relocs --oformat=elf32-littlearm -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map # Had to remove --emit-relocs to get compile working. Images don't work correctly (linked at 0, no relocations)
# --gc-sections # --emit-relocs
#
DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -g -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -g -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h
RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h

View File

@ -24,6 +24,8 @@ Abstract:
#ifndef __GNUC__ #ifndef __GNUC__
#include <windows.h> #include <windows.h>
#include <io.h> #include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -1034,14 +1036,20 @@ WriteSections(
- (SecOffset - SecShdr->sh_addr); - (SecOffset - SecShdr->sh_addr);
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
} }
} else if (Ehdr->e_machine == EM_ARM) { } else if (Ehdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) { switch (ELF32_R_TYPE(Rel->r_info)) {
case R_ARM_RBASE: // No relocation - no action required case R_ARM_RBASE: // No relocation - no action required
case R_ARM_PC24: // PC-relative relocations don't require modification
case R_ARM_XPC25: // PC-relative relocations don't require modification // Thease are all PC-relative relocations and don't require modification
case R_ARM_PC24:
case R_ARM_XPC25:
case R_ARM_THM_PC22:
case R_ARM_THM_JUMP19:
case R_ARM_CALL:
break; break;
case R_ARM_ABS32: case R_ARM_ABS32:
case R_ARM_RABS32: case R_ARM_RABS32:
// //
@ -1050,7 +1058,7 @@ WriteSections(
*(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + CoffSectionsOffset[Sym->st_shndx]; *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + CoffSectionsOffset[Sym->st_shndx];
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "WriteSections (): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
} }
} }
} }
@ -1124,7 +1132,7 @@ GetPhdrByIndex (
VOID VOID
WriteRelocations( WriteRelocations (
VOID VOID
) )
{ {
@ -1164,13 +1172,18 @@ WriteRelocations(
EFI_IMAGE_REL_BASED_HIGHLOW); EFI_IMAGE_REL_BASED_HIGHLOW);
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
} }
} else if (Ehdr->e_machine == EM_ARM) { } else if (Ehdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) { switch (ELF32_R_TYPE(Rel->r_info)) {
case R_ARM_RBASE: case R_ARM_RBASE: // No relocation - no action required
// Thease are all PC-relative relocations and don't require modification
case R_ARM_PC24: case R_ARM_PC24:
case R_ARM_XPC25: case R_ARM_XPC25:
case R_ARM_THM_PC22:
case R_ARM_THM_JUMP19:
case R_ARM_CALL:
break; break;
case R_ARM_ABS32: case R_ARM_ABS32:
case R_ARM_RABS32: case R_ARM_RABS32:
@ -1180,8 +1193,9 @@ WriteRelocations(
EFI_IMAGE_REL_BASED_HIGHLOW EFI_IMAGE_REL_BASED_HIGHLOW
); );
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "WriteRelocations(): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
} }
} else { } else {
Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) Ehdr->e_machine); Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) Ehdr->e_machine);
@ -1217,6 +1231,9 @@ WriteRelocations(
case DT_RELENT: case DT_RELENT:
RelElementSize = Dyn->d_un.d_val; RelElementSize = Dyn->d_un.d_val;
break; break;
default:
break;
} }
Dyn++; Dyn++;
} }
@ -1226,7 +1243,13 @@ WriteRelocations(
for (K = 0; K < RelSize; K += RelElementSize) { for (K = 0; K < RelSize; K += RelElementSize) {
if (DynamicSegment->p_paddr == 0) {
// This seems to be how it works on armcc???? Have the email in to find out?
Rel = (Elf32_Rel *) ((UINT8 *) Ehdr + DynamicSegment->p_offset + RelOffset + K); Rel = (Elf32_Rel *) ((UINT8 *) Ehdr + DynamicSegment->p_offset + RelOffset + K);
} else {
// This is how it reads in the ELF specification
Rel = (Elf32_Rel *) ((UINT8 *) Ehdr + RelOffset + K);
}
switch (ELF32_R_TYPE (Rel->r_info)) { switch (ELF32_R_TYPE (Rel->r_info)) {
case R_ARM_RBASE: case R_ARM_RBASE:
@ -1242,7 +1265,8 @@ WriteRelocations(
CoffAddFixup (CoffSectionsOffset[ELF32_R_SYM (Rel->r_info)] + (Rel->r_offset - TargetSegment->p_vaddr), EFI_IMAGE_REL_BASED_HIGHLOW); CoffAddFixup (CoffSectionsOffset[ELF32_R_SYM (Rel->r_info)] + (Rel->r_offset - TargetSegment->p_vaddr), EFI_IMAGE_REL_BASED_HIGHLOW);
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type.", mInImageName); Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info));
break;
} }
} }
break; break;
@ -1993,6 +2017,9 @@ Returns:
FILE *ReportFile; FILE *ReportFile;
CHAR8 *ReportFileName; CHAR8 *ReportFileName;
UINTN FileLen; UINTN FileLen;
time_t InputFileTime;
time_t OutputFileTime;
struct stat Stat_Buf;
SetUtilityName (UTILITY_NAME); SetUtilityName (UTILITY_NAME);
@ -2038,6 +2065,8 @@ Returns:
HiiSectionHeader = NULL; HiiSectionHeader = NULL;
NewBaseAddress = 0; NewBaseAddress = 0;
NegativeAddr = FALSE; NegativeAddr = FALSE;
InputFileTime = 0;
OutputFileTime = 0;
if (argc == 1) { if (argc == 1) {
Error (NULL, 0, 1001, "Missing options", "No input options."); Error (NULL, 0, 1001, "Missing options", "No input options.");
@ -2434,6 +2463,14 @@ Returns:
if (OutImageName != NULL) { if (OutImageName != NULL) {
fpOut = fopen (OutImageName, "rb"); fpOut = fopen (OutImageName, "rb");
if (fpOut != NULL) { if (fpOut != NULL) {
//
// Get Output file time stamp
//
fstat(fileno (fpOut), &Stat_Buf);
OutputFileTime = Stat_Buf.st_mtime;
//
// Get Output file data
//
OutputFileLength = _filelength (fileno (fpOut)); OutputFileLength = _filelength (fileno (fpOut));
OutputFileBuffer = malloc (OutputFileLength); OutputFileBuffer = malloc (OutputFileLength);
if (OutputFileBuffer == NULL) { if (OutputFileBuffer == NULL) {
@ -2460,6 +2497,14 @@ Returns:
Error (NULL, 0, 0001, "Error opening file", mInImageName); Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish; goto Finish;
} }
//
// Get Iutput file time stamp
//
fstat(fileno (fpIn), &Stat_Buf);
InputFileTime = Stat_Buf.st_mtime;
//
// Get Input file data
//
InputFileLength = _filelength (fileno (fpIn)); InputFileLength = _filelength (fileno (fpIn));
InputFileBuffer = malloc (InputFileLength); InputFileBuffer = malloc (InputFileLength);
if (InputFileBuffer == NULL) { if (InputFileBuffer == NULL) {
@ -3467,6 +3512,27 @@ Returns:
FileLength = FileLength + sizeof (EFI_TE_IMAGE_HEADER); FileLength = FileLength + sizeof (EFI_TE_IMAGE_HEADER);
memcpy (FileBuffer, &TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER)); memcpy (FileBuffer, &TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER));
VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength)); VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength));
} else {
//
// Following codes are to fix the objcopy's issue:
// objcopy in binutil 2.50.18 will set PE image's charactices to "RELOC_STRIPPED" if image has no ".reloc" section
// It cause issue for EFI image which has no ".reloc" sections.
// Following codes will be removed when objcopy in binutil fix this problem for PE image.
//
if ((PeHdr->Pe32.FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0) {
if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->Pe32.OptionalHeader;
if (Optional32->ImageBase == 0) {
PeHdr->Pe32.FileHeader.Characteristics &= ~EFI_IMAGE_FILE_RELOCS_STRIPPED;
}
} else if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
if (Optional64->ImageBase == 0) {
PeHdr->Pe32.FileHeader.Characteristics &= ~EFI_IMAGE_FILE_RELOCS_STRIPPED;
}
}
}
} }
WriteFile: WriteFile:
@ -3487,7 +3553,10 @@ WriteFile:
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
} }
} else { } else {
if ((FileLength != OutputFileLength) || (memcmp (FileBuffer, OutputFileBuffer, FileLength) != 0)) { if ((OutputFileTime < InputFileTime) || (FileLength != OutputFileLength) || (memcmp (FileBuffer, OutputFileBuffer, FileLength) != 0)) {
//
// Update File when File is changed or File is old.
//
fpOut = fopen (OutImageName, "wb"); fpOut = fopen (OutImageName, "wb");
if (fpOut == NULL) { if (fpOut == NULL) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName); Error (NULL, 0, 0001, "Error opening output file", OutImageName);

View File

@ -597,6 +597,8 @@ typedef struct {
#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */ #define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */
#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */ #define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */
#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */ #define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */
#define R_ARM_CALL 28
#define R_ARM_THM_JUMP19 51
#define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTENTRY 100
#define R_ARM_GNU_VTINHERIT 101 #define R_ARM_GNU_VTINHERIT 101
#define R_ARM_RSBREL32 250 #define R_ARM_RSBREL32 250

View File

@ -1,7 +1,7 @@
## @file ## @file
# Create makefile for MS nmake and GNU make # Create makefile for MS nmake and GNU make
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -26,7 +26,7 @@ from BuildEngine import *
import Common.GlobalData as GlobalData import Common.GlobalData as GlobalData
## Regular expression for finding header file inclusions ## Regular expression for finding header file inclusions
gIncludePattern = re.compile(r"^[ \t]*#[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<][ \t]*)([\w.\\/]+)(?:[ \t]*[\">])", re.MULTILINE|re.UNICODE) gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<]?[ \t]*)([\w.\\/]+)(?:[ \t]*[\">]?)", re.MULTILINE|re.UNICODE)
## Regular expression for matching macro used in header file inclusion ## Regular expression for matching macro used in header file inclusion
gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define each component of DSC file # This file is used to define each component of DSC file
# #
# Copyright (c) 2007 ~ 2008, Intel Corporation # Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -989,10 +989,14 @@ class Dsc(DscObject):
# #
elif PreviousIf[2] in (MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, Model): elif PreviousIf[2] in (MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, Model):
List = PreviousIf[0].split(' ') List = PreviousIf[0].split(' ')
Value1, Value2, Value3 = '', '==', '0'
if len(List) == 3:
Value1 = List[0] Value1 = List[0]
Value2 = List[1] Value2 = List[1]
Value3 = List[2] Value3 = List[2]
Value3 = SplitString(Value3) Value3 = SplitString(Value3)
if len(List) == 1:
Value1 = List[0]
Model = PreviousIf[2] Model = PreviousIf[2]
self.TblDsc.Insert(Model, Value1, Value2, Value3, ArchList, BelongsToItem, self.FileID, PreviousIf[1], StartColumn, EndLine, EndColumn, Enabled) self.TblDsc.Insert(Model, Value1, Value2, Value3, ArchList, BelongsToItem, self.FileID, PreviousIf[1], StartColumn, EndLine, EndColumn, Enabled)
# #

View File

@ -1760,8 +1760,8 @@ class FdfParser(object):
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex byte At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex byte At Line ", self.FileName, self.CurrentLineNumber)
if len(self.__Token) > 4: if len(self.__Token) > 18:
raise Warning("Hex byte(must be 2 digits) too long At Line ", self.FileName, self.CurrentLineNumber) raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
DataString = self.__Token DataString = self.__Token
DataString += "," DataString += ","
@ -1792,8 +1792,8 @@ class FdfParser(object):
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex byte At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex byte At Line ", self.FileName, self.CurrentLineNumber)
if len(self.__Token) > 4: if len(self.__Token) > 18:
raise Warning("Hex byte(must be 2 digits) too long At Line ", self.FileName, self.CurrentLineNumber) raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
DataString = self.__Token DataString = self.__Token
DataString += "," DataString += ","

View File

@ -291,9 +291,10 @@ def QueryInfItem(Table, Model, BelongsToItem):
# @retval truple() A truple structure as (Family, ToolChain, Flag) # @retval truple() A truple structure as (Family, ToolChain, Flag)
# #
def GetBuildOption(String, File, LineNo = -1): def GetBuildOption(String, File, LineNo = -1):
(Family, ToolChain, Flag) = ('', '', '')
if String.find(TAB_EQUAL_SPLIT) < 0: if String.find(TAB_EQUAL_SPLIT) < 0:
RaiseParserError(String, 'BuildOptions', File, '[<Family>:]<ToolFlag>=Flag', LineNo) RaiseParserError(String, 'BuildOptions', File, '[<Family>:]<ToolFlag>=Flag', LineNo)
(Family, ToolChain, Flag) = ('', '', '') else:
List = GetSplitValueList(String, TAB_EQUAL_SPLIT, MaxSplit = 1) List = GetSplitValueList(String, TAB_EQUAL_SPLIT, MaxSplit = 1)
if List[0].find(':') > -1: if List[0].find(':') > -1:
Family = List[0][ : List[0].find(':')].strip() Family = List[0][ : List[0].find(':')].strip()
@ -301,7 +302,6 @@ def GetBuildOption(String, File, LineNo = -1):
else: else:
ToolChain = List[0].strip() ToolChain = List[0].strip()
Flag = List[1].strip() Flag = List[1].strip()
return (Family, ToolChain, Flag) return (Family, ToolChain, Flag)
## Get Library Class ## Get Library Class

View File

@ -1787,12 +1787,20 @@ class FdfParser:
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber)
if len(self.__Token) > 4: if len(self.__Token) > 18:
raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber) raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
DataString = self.__Token # convert hex string value to byte hex string array
DataString += "," AllString = self.__Token
AllStrLen = len (AllString)
DataString = ""
while AllStrLen > 4:
DataString = DataString + "0x" + AllString[AllStrLen - 2: AllStrLen] + ","
AllStrLen = AllStrLen - 2
DataString = DataString + AllString[:AllStrLen] + ","
# byte value array
if len (self.__Token) <= 4:
while self.__IsToken(","): while self.__IsToken(","):
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber) raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
@ -1819,14 +1827,23 @@ class FdfParser:
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber)
if len(self.__Token) > 4: if len(self.__Token) > 18:
raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber) raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
DataString = self.__Token # convert hex string value to byte hex string array
DataString += "," AllString = self.__Token
AllStrLen = len (AllString)
DataString = ""
while AllStrLen > 4:
DataString = DataString + "0x" + AllString[AllStrLen - 2: AllStrLen] + ","
AllStrLen = AllStrLen - 2
DataString = DataString + AllString[:AllStrLen] + ","
# byte value array
if len (self.__Token) <= 4:
while self.__IsToken(","): while self.__IsToken(","):
self.__GetNextHexNumber() if not self.__GetNextHexNumber():
raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
if len(self.__Token) > 4: if len(self.__Token) > 4:
raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber) raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
DataString += self.__Token DataString += self.__Token

View File

@ -221,7 +221,7 @@ class LibraryReport(object):
EdkIILibInfo += " C = " + LibConstructor EdkIILibInfo += " C = " + LibConstructor
LibDestructor = " ".join(LibraryItem[3]) LibDestructor = " ".join(LibraryItem[3])
if LibDestructor: if LibDestructor:
EdkIILibInfo += " D = " + LibConstructor EdkIILibInfo += " D = " + LibDestructor
LibDepex = " ".join(LibraryItem[4]) LibDepex = " ".join(LibraryItem[4])
if LibDepex: if LibDepex:
EdkIILibInfo += " Depex = " + LibDepex EdkIILibInfo += " Depex = " + LibDepex
@ -255,7 +255,8 @@ class DepexReport(object):
ModuleType = M.ModuleType ModuleType = M.ModuleType
if not ModuleType: if not ModuleType:
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "") ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE"]:
if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "UEFI_APPLICATION"]:
return return
for Source in M.SourceFileList: for Source in M.SourceFileList:
@ -404,6 +405,7 @@ class ModuleReport(object):
self.Size = 0 self.Size = 0
self.BuildTimeStamp = None self.BuildTimeStamp = None
self.DriverType = "" self.DriverType = ""
if not M.IsLibrary:
ModuleType = M.ModuleType ModuleType = M.ModuleType
if not ModuleType: if not ModuleType:
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "") ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
@ -414,7 +416,7 @@ class ModuleReport(object):
PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000") PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
if int(PiSpec, 0) >= 0x0001000A: if int(PiSpec, 0) >= 0x0001000A:
ModuleType = "SMM_DRIVER" ModuleType = "SMM_DRIVER"
self.DriverType = gDriverTypeMap.get(ModuleType, "") self.DriverType = gDriverTypeMap.get(ModuleType, "0x2 (FREE_FORM)")
self.UefiSpecVersion = M.Module.Specification.get("UEFI_SPECIFICATION_VERSION", "") self.UefiSpecVersion = M.Module.Specification.get("UEFI_SPECIFICATION_VERSION", "")
self.PiSpecVersion = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "") self.PiSpecVersion = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "")
self.PciDeviceId = M.Module.Defines.get("PCI_DEVICE_ID", "") self.PciDeviceId = M.Module.Defines.get("PCI_DEVICE_ID", "")
@ -1310,9 +1312,11 @@ class PlatformReport(object):
self.ModuleReportList = [] self.ModuleReportList = []
if MaList != None: if MaList != None:
self._IsModuleBuild = True
for Ma in MaList: for Ma in MaList:
self.ModuleReportList.append(ModuleReport(Ma, ReportType)) self.ModuleReportList.append(ModuleReport(Ma, ReportType))
else: else:
self._IsModuleBuild = False
for Pa in Wa.AutoGenObjectList: for Pa in Wa.AutoGenObjectList:
for ModuleKey in Pa.Platform.Modules: for ModuleKey in Pa.Platform.Modules:
self.ModuleReportList.append(ModuleReport(Pa.Platform.Modules[ModuleKey].M, ReportType)) self.ModuleReportList.append(ModuleReport(Pa.Platform.Modules[ModuleKey].M, ReportType))
@ -1343,6 +1347,7 @@ class PlatformReport(object):
FileWrite(File, "Build Duration: %s" % BuildDuration) FileWrite(File, "Build Duration: %s" % BuildDuration)
FileWrite(File, "Report Content: %s" % ", ".join(ReportType)) FileWrite(File, "Report Content: %s" % ", ".join(ReportType))
if not self._IsModuleBuild:
if "PCD" in ReportType: if "PCD" in ReportType:
self.PcdReport.GenerateReport(File, None) self.PcdReport.GenerateReport(File, None)
@ -1353,6 +1358,7 @@ class PlatformReport(object):
for ModuleReportItem in self.ModuleReportList: for ModuleReportItem in self.ModuleReportList:
ModuleReportItem.GenerateReport(File, self.PcdReport, self.PredictionReport, ReportType) ModuleReportItem.GenerateReport(File, self.PcdReport, self.PredictionReport, ReportType)
if not self._IsModuleBuild:
if "EXECUTION_ORDER" in ReportType: if "EXECUTION_ORDER" in ReportType:
self.PredictionReport.GenerateReport(File, None) self.PredictionReport.GenerateReport(File, None)

View File

@ -1090,9 +1090,10 @@ class Build():
## Collect MAP information of all FVs ## Collect MAP information of all FVs
# #
def _CollectFvMapBuffer (self, MapBuffer, Wa): def _CollectFvMapBuffer (self, MapBuffer, Wa, ModuleList):
if self.Fdf != '': if self.Fdf != '':
# First get the XIP base address for FV map file. # First get the XIP base address for FV map file.
GuidPattern = re.compile("[-a-fA-F0-9]+")
for FvName in Wa.FdfProfile.FvDict.keys(): for FvName in Wa.FdfProfile.FvDict.keys():
FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map') FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map')
if not os.path.exists(FvMapBuffer): if not os.path.exists(FvMapBuffer):
@ -1103,7 +1104,16 @@ class Build():
FvMap.readline() FvMap.readline()
FvMap.readline() FvMap.readline()
FvMap.readline() FvMap.readline()
MapBuffer.write(FvMap.read()) for Line in FvMap:
MatchGuid = GuidPattern.match(Line)
if MatchGuid != None:
#
# Replace GUID with module name
#
GuidString = MatchGuid.group()
if GuidString.upper() in ModuleList:
Line = Line.replace(GuidString, ModuleList[GuidString.upper()].Name)
MapBuffer.write('%s' % (Line))
FvMap.close() FvMap.close()
## Collect MAP information of all modules ## Collect MAP information of all modules
@ -1124,7 +1134,8 @@ class Build():
IsIpfPlatform = False IsIpfPlatform = False
if 'IPF' in self.ArchList: if 'IPF' in self.ArchList:
IsIpfPlatform = True IsIpfPlatform = True
for Module in ModuleList: for ModuleGuid in ModuleList:
Module = ModuleList[ModuleGuid]
GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (Module.MetaFile, Module.Arch, Module.ToolChain, Module.BuildTarget) GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (Module.MetaFile, Module.Arch, Module.ToolChain, Module.BuildTarget)
OutputImageFile = '' OutputImageFile = ''
@ -1259,6 +1270,7 @@ class Build():
# #
SaveFileOnChange(MapFilePath, MapBuffer.getvalue(), False) SaveFileOnChange(MapFilePath, MapBuffer.getvalue(), False)
MapBuffer.close() MapBuffer.close()
if self.LoadFixAddress != 0:
sys.stdout.write ("\nLoad Module At Fix Address Map file saved to %s\n" %(MapFilePath)) sys.stdout.write ("\nLoad Module At Fix Address Map file saved to %s\n" %(MapFilePath))
sys.stdout.flush() sys.stdout.flush()
@ -1286,7 +1298,7 @@ class Build():
self._Build(self.Target, Wa) self._Build(self.Target, Wa)
# Create MAP file when Load Fix Address is enabled. # Create MAP file when Load Fix Address is enabled.
if self.Target in ["", "all", "fds"] and self.LoadFixAddress != 0: if self.Target in ["", "all", "fds"]:
for Arch in self.ArchList: for Arch in self.ArchList:
# #
# Check whether the set fix address is above 4G for 32bit image. # Check whether the set fix address is above 4G for 32bit image.
@ -1296,15 +1308,16 @@ class Build():
# #
# Get Module List # Get Module List
# #
ModuleList = [] ModuleList = {}
for Pa in Wa.AutoGenObjectList: for Pa in Wa.AutoGenObjectList:
for Ma in Pa.ModuleAutoGenList: for Ma in Pa.ModuleAutoGenList:
if Ma == None: if Ma == None:
continue continue
if not Ma.IsLibrary: if not Ma.IsLibrary:
ModuleList.append (Ma) ModuleList[Ma.Guid.upper()] = Ma
MapBuffer = StringIO('') MapBuffer = StringIO('')
if self.LoadFixAddress != 0:
# #
# Rebase module to the preferred memory address before GenFds # Rebase module to the preferred memory address before GenFds
# #
@ -1317,7 +1330,7 @@ class Build():
# #
# Create MAP file for all platform FVs after GenFds. # Create MAP file for all platform FVs after GenFds.
# #
self._CollectFvMapBuffer(MapBuffer, Wa) self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
# #
# Save MAP buffer into MAP file. # Save MAP buffer into MAP file.
# #
@ -1367,7 +1380,7 @@ class Build():
ExtraData=self.ModuleFile ExtraData=self.ModuleFile
) )
# Create MAP file when Load Fix Address is enabled. # Create MAP file when Load Fix Address is enabled.
if self.LoadFixAddress != 0 and self.Target == "fds" and self.Fdf != '': if self.Target == "fds" and self.Fdf != '':
for Arch in self.ArchList: for Arch in self.ArchList:
# #
# Check whether the set fix address is above 4G for 32bit image. # Check whether the set fix address is above 4G for 32bit image.
@ -1377,15 +1390,16 @@ class Build():
# #
# Get Module List # Get Module List
# #
ModuleList = [] ModuleList = {}
for Pa in Wa.AutoGenObjectList: for Pa in Wa.AutoGenObjectList:
for Ma in Pa.ModuleAutoGenList: for Ma in Pa.ModuleAutoGenList:
if Ma == None: if Ma == None:
continue continue
if not Ma.IsLibrary: if not Ma.IsLibrary:
ModuleList.append (Ma) ModuleList[Ma.Guid.upper()] = Ma
MapBuffer = StringIO('') MapBuffer = StringIO('')
if self.LoadFixAddress != 0:
# #
# Rebase module to the preferred memory address before GenFds # Rebase module to the preferred memory address before GenFds
# #
@ -1397,7 +1411,7 @@ class Build():
# #
# Create MAP file for all platform FVs after GenFds. # Create MAP file for all platform FVs after GenFds.
# #
self._CollectFvMapBuffer(MapBuffer, Wa) self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
# #
# Save MAP buffer into MAP file. # Save MAP buffer into MAP file.
# #
@ -1483,7 +1497,7 @@ class Build():
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule) EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
# Create MAP file when Load Fix Address is enabled. # Create MAP file when Load Fix Address is enabled.
if self.Target in ["", "all", "fds"] and self.LoadFixAddress != 0: if self.Target in ["", "all", "fds"]:
for Arch in self.ArchList: for Arch in self.ArchList:
# #
# Check whether the set fix address is above 4G for 32bit image. # Check whether the set fix address is above 4G for 32bit image.
@ -1493,17 +1507,18 @@ class Build():
# #
# Get Module List # Get Module List
# #
ModuleList = [] ModuleList = {}
for Pa in Wa.AutoGenObjectList: for Pa in Wa.AutoGenObjectList:
for Ma in Pa.ModuleAutoGenList: for Ma in Pa.ModuleAutoGenList:
if Ma == None: if Ma == None:
continue continue
if not Ma.IsLibrary: if not Ma.IsLibrary:
ModuleList.append (Ma) ModuleList[Ma.Guid.upper()] = Ma
# #
# Rebase module to the preferred memory address before GenFds # Rebase module to the preferred memory address before GenFds
# #
MapBuffer = StringIO('') MapBuffer = StringIO('')
if self.LoadFixAddress != 0:
self._CollectModuleMapBuffer(MapBuffer, ModuleList) self._CollectModuleMapBuffer(MapBuffer, ModuleList)
# Generate FD image if there's a FDF file found # Generate FD image if there's a FDF file found
@ -1511,12 +1526,12 @@ class Build():
LaunchCommand(Wa.BuildCommand + ["fds"], Wa.MakeFileDir) LaunchCommand(Wa.BuildCommand + ["fds"], Wa.MakeFileDir)
# Create MAP file for all platform FV after GenFds # Create MAP file for all platform FV after GenFds
if self.Target in ["", "all", "fds"] and self.LoadFixAddress != 0: if self.Target in ["", "all", "fds"]:
if self.Fdf != '': if self.Fdf != '':
# #
# Create MAP file for all platform FVs after GenFds. # Create MAP file for all platform FVs after GenFds.
# #
self._CollectFvMapBuffer(MapBuffer, Wa) self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
# #
# Save MAP buffer into MAP file. # Save MAP buffer into MAP file.
# #