Michael: Do you use the linker script BaseTools/Scripts/GccBase.lds and -z common-page-size=4096?
Thanks Liming From: Michael Zimmermann [mailto:[email protected]] Sent: Wednesday, September 9, 2015 3:22 PM To: Yao, Jiewen Cc: Gao, Liming; [email protected] Subject: Re: [edk2] Section Alignment of elf binaries compiled with GCC(Linux) Unfortunately I missed the replies but I debugged this problem further and the Problem is that GenFw set's the alignment based on "sh_addralign" in the Elf header. The 'common-page-size' flag doesn't change the value of this field though. what it does change is the Alignment value of the Program Headers: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x010000 0x00000000 0x00000000 0x042f8 0x042f8 R E 0x10000 LOAD 0x0142f8 0x000142f8 0x000142f8 0x000d4 0x000f4 RW 0x10000 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x10 the section alignment still stays at 0/1/4. On Tue, Aug 18, 2015 at 4:49 AM, Yao, Jiewen <[email protected]<mailto:[email protected]>> wrote: OK -----Original Message----- From: Gao, Liming Sent: Tuesday, August 18, 2015 10:48 AM To: Yao, Jiewen; Michael Zimmermann; [email protected]<mailto:[email protected]> Subject: RE: [edk2] Section Alignment of elf binaries compiled with GCC(Linux) Jiewen: The updated message is useful. I suggest to change error level from EFI_D_ERROR to EFI_D_INFO. Thanks Liming -----Original Message----- From: Yao, Jiewen Sent: Tuesday, August 18, 2015 10:46 AM To: Gao, Liming; Michael Zimmermann; [email protected]<mailto:[email protected]> Subject: RE: [edk2] Section Alignment of elf binaries compiled with GCC(Linux) Hi How about we update debug message like below: Index: PropertiesTable.c =================================================================== --- PropertiesTable.c (revision 18191) +++ PropertiesTable.c (working copy) @@ -1120,7 +1120,7 @@ SetPropertiesTableSectionAlignment (SectionAlignment); if ((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) { - DEBUG ((EFI_D_ERROR, "!!!!!!!! InsertImageRecord - Section Alignment(0x%x) is not %dK !!!!!!!!\n", + DEBUG ((EFI_D_ERROR, "!!!!!!!! UEFI2.5 PropertiesTable - Runtime Driver Section Alignment(0x%x) is not %dK !!!!!!!!\n", SectionAlignment, EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT >> 10)); PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress); if (PdbPointer != NULL) { -----Original Message----- From: edk2-devel [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Gao, Liming Sent: Tuesday, August 18, 2015 10:39 AM To: Michael Zimmermann; [email protected]<mailto:[email protected]> Subject: Re: [edk2] Section Alignment of elf binaries compiled with GCC(Linux) Hi, This is a warning message that describes the runtime driver alignment is not 4K. UEFI PropertiesTable table feature expects all runtime driver alignment is 4K. When DxeCore loads Runtime driver, it will check its alignment and report such warning message if it doesn't meet with the alignment. If you want to enable this feature, you need to make sure all runtime driver at 4K. If you don't enable it, you can just ignore this message. To configure runtime driver with 4K alignment, you can modify DSC file to add the following section. [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] GCC: *_*_*_DLINK_FLAGS = -z common-page-size=0x1000 MSFT: *_*_*_DLINK_FLAGS = /ALIGN:4096 Thanks Liming -----Original Message----- From: edk2-devel [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Michael Zimmermann Sent: Sunday, August 16, 2015 12:32 PM To: [email protected]<mailto:[email protected]> Subject: [edk2] Section Alignment of elf binaries compiled with GCC(Linux) When booting(a new device I'm currently working on) I get these warnings: !!!!!!!! InsertImageRecord - Section Alignment(0x20) is not 4K !!!!!!!! the warning is raised by "MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c" and when compiling using GCC from Linux, the SectionAlignment is set by "BaseTools/Source/C/GenFw/Elf32Convert.c". I checked the resulting binaries using "readpe" and indeed they have a SectionAlignment of 0x20, while the precompiled binaries like Shell.efi have a Alignment of 0x1000(4K). So, is this a bug of my GCC compiler or of EDK2? _______________________________________________ edk2-devel mailing list [email protected]<mailto:[email protected]> https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected]<mailto:[email protected]> https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

