diff options
| author | Martin Storsjo <martin@martin.st> | 2019-01-23 08:25:28 +0000 | 
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2019-01-23 08:25:28 +0000 | 
| commit | 12b6b802080e0000ce81c58aeb15b4a59290f86f (patch) | |
| tree | a9f83e06bf77c840559032a036146fc23afcb87d /llvm/tools/llvm-objcopy/COFF/Writer.cpp | |
| parent | 3ff5dfd7359de4a6e272ab87b96d1e73b1e57469 (diff) | |
| download | bcm5719-llvm-12b6b802080e0000ce81c58aeb15b4a59290f86f.tar.gz bcm5719-llvm-12b6b802080e0000ce81c58aeb15b4a59290f86f.zip | |
Reapply: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
This was reverted since it broke a couple buildbots. The reason
for the breakage is not yet known, but this time, the test has
got more diagnostics added, to hopefully allow figuring out
what goes wrong.
Differential Revision: https://reviews.llvm.org/D57007
llvm-svn: 351931
Diffstat (limited to 'llvm/tools/llvm-objcopy/COFF/Writer.cpp')
| -rw-r--r-- | llvm/tools/llvm-objcopy/COFF/Writer.cpp | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp index db3589bb119..05e46291c39 100644 --- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp +++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp @@ -286,14 +286,15 @@ void COFFWriter::writeHeaders(bool IsBigObj) {  void COFFWriter::writeSections() {    for (const auto &S : Obj.getSections()) {      uint8_t *Ptr = Buf.getBufferStart() + S.Header.PointerToRawData; -    std::copy(S.Contents.begin(), S.Contents.end(), Ptr); +    ArrayRef<uint8_t> Contents = S.getContents(); +    std::copy(Contents.begin(), Contents.end(), Ptr);      // For executable sections, pad the remainder of the raw data size with      // 0xcc, which is int3 on x86.      if ((S.Header.Characteristics & IMAGE_SCN_CNT_CODE) && -        S.Header.SizeOfRawData > S.Contents.size()) -      memset(Ptr + S.Contents.size(), 0xcc, -             S.Header.SizeOfRawData - S.Contents.size()); +        S.Header.SizeOfRawData > Contents.size()) +      memset(Ptr + Contents.size(), 0xcc, +             S.Header.SizeOfRawData - Contents.size());      Ptr += S.Header.SizeOfRawData;      for (const auto &R : S.Relocs) { | 

