diff options
-rw-r--r-- | lld/COFF/Chunks.h | 2 | ||||
-rw-r--r-- | lld/COFF/Writer.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h index ddfb5febdc2..e110760bca7 100644 --- a/lld/COFF/Chunks.h +++ b/lld/COFF/Chunks.h @@ -82,7 +82,7 @@ public: // An output section has pointers to chunks in the section, and each // chunk has a back pointer to an output section. void setOutputSection(OutputSection *O) { Out = O; } - OutputSection *getOutputSection() { return Out; } + OutputSection *getOutputSection() const { return Out; } // Windows-specific. // Collect all locations that contain absolute addresses for base relocations. diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 2cc1b35fee2..96d31ab1033 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -65,8 +65,9 @@ public: D->Type = COFF::IMAGE_DEBUG_TYPE_CODEVIEW; D->SizeOfData = Record->getSize(); D->AddressOfRawData = Record->getRVA(); - // TODO(compnerd) get the file offset - D->PointerToRawData = 0; + OutputSection *OS = Record->getOutputSection(); + uint64_t Offs = OS->getFileOff() + (Record->getRVA() - OS->getRVA()); + D->PointerToRawData = Offs; ++D; } |