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)) {
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;
}