]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add more judgement.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Apr 2007 08:18:50 +0000 (08:18 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Apr 2007 08:18:50 +0000 (08:18 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2539 6f19259b-4bc3-4df7-8a09-765794883524

Tools/CCode/Source/FwImage/fwimage.c

index 11090952cd61d27162bc8b75ffee933ffdea8d12..97229ce09e57d1816d953095033b0fd172470bdb 100644 (file)
@@ -340,7 +340,9 @@ ScanSections(
       // 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
+      if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {\r
+        CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);\r
+      }\r
 \r
       /* Relocate entry.  */
       if ((Ehdr->e_entry >= shdr->sh_addr) && \r
@@ -364,8 +366,10 @@ ScanSections(
       // 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
-
+      if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {\r
+        CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);\r
+      }
+     \r
       CoffSectionsOffset[i] = CoffOffset;
       CoffOffset += shdr->sh_size;
     }