summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-05 07:04:33 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-05 07:04:33 +0000
commit1d6992b936def4fa9bd8a9b64877b063eddd1d5d (patch)
treeecb9f944e80c91d79f387e76d8aa267960db2aac /Tools
parent8d7538351f1460a3312f69db2f5eb5aaf2c2a1df (diff)
downloadedk2-1d6992b936def4fa9bd8a9b64877b063eddd1d5d.tar.gz
edk2-1d6992b936def4fa9bd8a9b64877b063eddd1d5d.tar.bz2
edk2-1d6992b936def4fa9bd8a9b64877b063eddd1d5d.zip
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
Diffstat (limited to 'Tools')
-rw-r--r--Tools/CCode/Source/FwImage/fwimage.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Tools/CCode/Source/FwImage/fwimage.c b/Tools/CCode/Source/FwImage/fwimage.c
index a4ae10c4c2..11090952cd 100644
--- a/Tools/CCode/Source/FwImage/fwimage.c
+++ b/Tools/CCode/Source/FwImage/fwimage.c
@@ -337,9 +337,11 @@ ScanSections(
Elf_Shdr *shdr = GetShdrByIndex(i);
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);
+
/* Relocate entry. */
if ((Ehdr->e_entry >= shdr->sh_addr) &&
(Ehdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
@@ -357,7 +359,13 @@ ScanSections(
DataOffset = CoffOffset;
for (i = 0; i < Ehdr->e_shnum; 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;
CoffOffset += shdr->sh_size;
}