[llvm-objcopy] [COFF] Do not patch debug entries if PointerToRawData is zero
authorPirama Arumuga Nainar <pirama@google.com>
Tue, 3 Aug 2021 05:17:53 +0000 (22:17 -0700)
committerPirama Arumuga Nainar <pirama@google.com>
Fri, 6 Aug 2021 16:23:25 +0000 (09:23 -0700)
commit16ebb7ab5c462518388527b6ebee2f0e1080b777
treec83e08db2779850b5c18b814626ecaa352c2658a
parente4cc071e9220333d47d5f9b399080e5ab21051f5
[llvm-objcopy] [COFF] Do not patch debug entries if PointerToRawData is zero

Fix an edge case missed by https://reviews.llvm.org/D78921.  For e.g.,
the Repro debug entry (generated with the /Brepro linker flag) does not
have a debug-directory payload.  Do not attempt to patch Debug entries
without a payload.

Differential Revision: https://reviews.llvm.org/D107324
llvm/test/tools/llvm-objcopy/COFF/debug-dir-unmapped.test
llvm/test/tools/llvm-objcopy/COFF/debug-entry-no-payload.test [new file with mode: 0644]
llvm/tools/llvm-objcopy/COFF/Writer.cpp