+ for (Index = 0; Index < mEhdr->e_shnum; Index++) {\r
+ Elf_Shdr *shdr = GetShdrByIndex(Index);\r
+\r
+ //\r
+ // The PT_DYNAMIC section contains DT_REL relocations whose r_offset\r
+ // field is relative to the base of a segment (or the entire image),\r
+ // and not to the base of an ELF input section as is the case for\r
+ // SHT_REL sections. This means that we cannot fix up such relocations\r
+ // unless we cross-reference ELF sections and segments, considering\r
+ // that the output placement recorded in mCoffSectionsOffset[] is\r
+ // section based, not segment based.\r
+ //\r
+ // Fortunately, there is a simple way around this: we require that the\r
+ // in-memory layout of the ELF and PE/COFF versions of the binary is\r
+ // identical. That way, r_offset will retain its validity as a PE/COFF\r
+ // image offset, and we can record it in the COFF fixup table\r
+ // unmodified.\r
+ //\r
+ if (shdr->sh_addr != mCoffSectionsOffset[Index]) {\r
+ Error (NULL, 0, 3000,\r
+ "Invalid", "%s: PT_DYNAMIC relocations require identical ELF and PE/COFF section offsets.",\r
+ mInImageName);\r
+ }\r
+ }\r
+\r