Check that COFF .obj files have sections with zero virtual address spaces.
[oota-llvm.git] / lib / Object / COFFObjectFile.cpp
index 19b53d8028d3eb3b02916b05387aa7f6c7cbb862..fcdd7d2c13b0452b3b2fdf4a0d94874ab4488c49 100644 (file)
@@ -361,6 +361,8 @@ getFirstReloc(const coff_section *Sec, MemoryBufferRef M, const uint8_t *Base) {
 relocation_iterator COFFObjectFile::section_rel_begin(DataRefImpl Ref) const {
   const coff_section *Sec = toSec(Ref);
   const coff_relocation *begin = getFirstReloc(Sec, Data, base());
+  if (begin && Sec->VirtualAddress != 0)
+    report_fatal_error("Sections with relocations should have an address of 0");
   DataRefImpl Ret;
   Ret.p = reinterpret_cast<uintptr_t>(begin);
   return relocation_iterator(RelocationRef(Ret, this));