[PATCH] D106940: Fix test for debug dir presence
Alfonso Sanchez-Beato via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 03:18:00 PDT 2021
alfonsosanchezbeato created this revision.
alfonsosanchezbeato added a reviewer: jakehehrlich.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
alfonsosanchezbeato requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
If the number of directories was 6 (equal to the DEBUG_DIRECTORY
index), patchDebugDirectory() was run even though the debug directory
is actually the 7th entry. Use <= in the comparison to fix that.
This fixes https://llvm.org/PR51243
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106940
Files:
llvm/tools/llvm-objcopy/COFF/Writer.cpp
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106940.362315.patch
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210728/d4fcca90/attachment.bin>
More information about the llvm-commits
mailing list