mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 00:24:07 +02:00
The alignment of data section also meet with the requirement of section itself.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2536 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
8d7538351f
commit
1d6992b936
@ -337,9 +337,11 @@ ScanSections(
|
|||||||
Elf_Shdr *shdr = GetShdrByIndex(i);
|
Elf_Shdr *shdr = GetShdrByIndex(i);
|
||||||
if (IsTextShdr(shdr)) {
|
if (IsTextShdr(shdr)) {
|
||||||
//
|
//
|
||||||
// Align the coff offset
|
// Align the coff offset to meet with the alignment requirement of section
|
||||||
|
// itself.
|
||||||
//
|
//
|
||||||
CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
|
CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
|
||||||
|
|
||||||
/* Relocate entry. */
|
/* Relocate entry. */
|
||||||
if ((Ehdr->e_entry >= shdr->sh_addr) &&
|
if ((Ehdr->e_entry >= shdr->sh_addr) &&
|
||||||
(Ehdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
|
(Ehdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
|
||||||
@ -357,7 +359,13 @@ ScanSections(
|
|||||||
DataOffset = CoffOffset;
|
DataOffset = CoffOffset;
|
||||||
for (i = 0; i < Ehdr->e_shnum; i++) {
|
for (i = 0; i < Ehdr->e_shnum; i++) {
|
||||||
Elf_Shdr *shdr = GetShdrByIndex(i);
|
Elf_Shdr *shdr = GetShdrByIndex(i);
|
||||||
if (IsDataShdr(shdr)) {
|
if (IsDataShdr(shdr)) {
|
||||||
|
//
|
||||||
|
// Align the coff offset to meet with the alignment requirement of section
|
||||||
|
// itself.
|
||||||
|
//
|
||||||
|
CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
|
||||||
|
|
||||||
CoffSectionsOffset[i] = CoffOffset;
|
CoffSectionsOffset[i] = CoffOffset;
|
||||||
CoffOffset += shdr->sh_size;
|
CoffOffset += shdr->sh_size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user