Index: llvm/tools/llvm-objcopy/COFF/Writer.cpp =================================================================== --- llvm/tools/llvm-objcopy/COFF/Writer.cpp +++ llvm/tools/llvm-objcopy/COFF/Writer.cpp @@ -406,7 +406,7 @@ // the debug_directory structs in there, and set the PointerToRawData field // in all of them, according to their new physical location in the file. Error COFFWriter::patchDebugDirectory() { - if (Obj.DataDirectories.size() < DEBUG_DIRECTORY) + if (Obj.DataDirectories.size() <= DEBUG_DIRECTORY) return Error::success(); const data_directory *Dir = &Obj.DataDirectories[DEBUG_DIRECTORY]; if (Dir->Size <= 0)