From 12b6b802080e0000ce81c58aeb15b4a59290f86f Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 23 Jan 2019 08:25:28 +0000 Subject: 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 --- llvm/tools/llvm-objcopy/COFF/Object.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'llvm/tools/llvm-objcopy/COFF/Object.h') diff --git a/llvm/tools/llvm-objcopy/COFF/Object.h b/llvm/tools/llvm-objcopy/COFF/Object.h index 0630f9c5ff8..afa272286ef 100644 --- a/llvm/tools/llvm-objcopy/COFF/Object.h +++ b/llvm/tools/llvm-objcopy/COFF/Object.h @@ -35,11 +35,35 @@ struct Relocation { struct Section { object::coff_section Header; - ArrayRef Contents; std::vector Relocs; StringRef Name; ssize_t UniqueId; size_t Index; + + ArrayRef getContents() const { + if (!OwnedContents.empty()) + return OwnedContents; + return ContentsRef; + } + + void setContentsRef(ArrayRef Data) { + OwnedContents.clear(); + ContentsRef = Data; + } + + void setOwnedContents(std::vector &&Data) { + ContentsRef = ArrayRef(); + OwnedContents = std::move(Data); + } + + void clearContents() { + ContentsRef = ArrayRef(); + OwnedContents.clear(); + } + +private: + ArrayRef ContentsRef; + std::vector OwnedContents; }; struct Symbol { -- cgit v1.2.3