On 9 September 2015 at 11:54, Gao, Liming <liming....@intel.com> wrote: > Ard: > He reports that the 'common-page-size' flag doesn't work. When he > configures its value to 4096, the alignment in the converted EFI image is > still default 32. Could you help check it? > > The detail report is attached below. > 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. >
We should get confirmation that he is using the GCC linker script in addition to setting -z common-page-size, since the builtin linker script uses those macros in a slightly different way (as is obvious from the readelf program header dump above) -- Ard. > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard > Biesheuvel > Sent: Wednesday, September 09, 2015 5:51 PM > To: Gao, Liming > Cc: edk2-devel@lists.01.org; ler...@redhat.com; Liu, Yingke D; > leif.lindh...@linaro.org > Subject: Re: [edk2] [PATCH] BaseTools/GenFw: align RVA of debug > > On 9 September 2015 at 11:46, Gao, Liming <liming....@intel.com> wrote: >> Ard: >> Dose this patch fix Section Alignment of elf binaries compiled with >> GCC(Linux) reported by Michael Zimmermann <sigmaepsilo...@gmail.com>? >> > > No. This fixes a problem on 32-bit ARM where the debug entry is resolved > before the MMU is up, which results in an alignment fault. > > The issue you refer to is about the properties table memory protection > feature, right? > > >> -----Original Message----- >> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] >> Sent: Wednesday, September 09, 2015 5:44 PM >> To: edk2-devel@lists.01.org; Gao, Liming; Liu, Yingke D >> Cc: leif.lindh...@linaro.org; ler...@redhat.com; Ard Biesheuvel >> Subject: [PATCH] BaseTools/GenFw: align RVA of debug >> >> SVN commit r18077 ("BaseTools/GenFw: move .debug contents to .data to save >> space") removed the separate .debug section after moving its contents into >> .text or .data. However, this change does not take into account that some of >> these contents need to appear at a 32-bit aligned offset. So align the debug >> data RVA to 32 bits. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> >> --- >> BaseTools/Source/C/GenFw/Elf32Convert.c | 13 +++++++++++-- >> BaseTools/Source/C/GenFw/Elf64Convert.c | 13 +++++++++++-- >> 2 files changed, 22 insertions(+), 4 deletions(-) >> >> diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c >> b/BaseTools/Source/C/GenFw/Elf32Convert.c >> index e1b92ebd713e..4b330a61669f 100644 >> --- a/BaseTools/Source/C/GenFw/Elf32Convert.c >> +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c >> @@ -218,6 +218,15 @@ CoffAlign ( >> return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1); } >> >> +STATIC >> +UINT32 >> +DebugRvaAlign ( >> + UINT32 Offset >> + ) >> +{ >> + return (Offset + 3) & ~3; >> +} >> + >> // >> // filter functions >> // >> @@ -365,7 +374,7 @@ ScanSections32 ( >> assert (FALSE); >> } >> >> - mDebugOffset = mCoffOffset; >> + mDebugOffset = DebugRvaAlign(mCoffOffset); >> >> if (mEhdr->e_machine != EM_ARM) { >> mCoffOffset = CoffAlign(mCoffOffset); @@ -423,7 +432,7 @@ >> ScanSections32 ( >> // section alignment. >> // >> if (SectionCount > 0) { >> - mDebugOffset = mCoffOffset; >> + mDebugOffset = DebugRvaAlign(mCoffOffset); >> } >> mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + >> sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + diff >> --git a/BaseTools/Source/C/GenFw/Elf64Convert.c >> b/BaseTools/Source/C/GenFw/Elf64Convert.c >> index c758ed9d64a6..a3f1f5d3d4c7 100644 >> --- a/BaseTools/Source/C/GenFw/Elf64Convert.c >> +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c >> @@ -211,6 +211,15 @@ CoffAlign ( >> return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1); } >> >> +STATIC >> +UINT32 >> +DebugRvaAlign ( >> + UINT32 Offset >> + ) >> +{ >> + return (Offset + 3) & ~3; >> +} >> + >> // >> // filter functions >> // >> @@ -359,7 +368,7 @@ ScanSections64 ( >> assert (FALSE); >> } >> >> - mDebugOffset = mCoffOffset; >> + mDebugOffset = DebugRvaAlign(mCoffOffset); >> >> if (mEhdr->e_machine != EM_ARM) { >> mCoffOffset = CoffAlign(mCoffOffset); @@ -412,7 +421,7 @@ >> ScanSections64 ( >> // section alignment. >> // >> if (SectionCount > 0) { >> - mDebugOffset = mCoffOffset; >> + mDebugOffset = DebugRvaAlign(mCoffOffset); >> } >> mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + >> sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + >> -- >> 1.9.1 >> > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel