]> git.proxmox.com Git - mirror_edk2.git/commitdiff
The alignment of data section also meet with the requirement of section itself.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Apr 2007 07:04:33 +0000 (07:04 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Apr 2007 07:04:33 +0000 (07:04 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2536 6f19259b-4bc3-4df7-8a09-765794883524

Tools/CCode/Source/FwImage/fwimage.c

index a4ae10c4c26dcbd23a4008fd12433dd652301aec..11090952cd61d27162bc8b75ffee933ffdea8d12 100644 (file)
@@ -337,9 +337,11 @@ ScanSections(
     Elf_Shdr *shdr = GetShdrByIndex(i);
     if (IsTextShdr(shdr)) {\r
       //\r
-      // Align the coff offset\r
+      // Align the coff offset to meet with the alignment requirement of section\r
+      // itself.\r
       // \r
       CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);\r
+\r
       /* Relocate entry.  */
       if ((Ehdr->e_entry >= shdr->sh_addr) && \r
           (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)) {\r
+      //\r
+      // Align the coff offset to meet with the alignment requirement of section\r
+      // itself.\r
+      // \r
+      CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);\r
+
       CoffSectionsOffset[i] = CoffOffset;
       CoffOffset += shdr->sh_size;
     }