summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objcopy/COFF/Object.h
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-01-23 08:25:28 +0000
committerMartin Storsjo <martin@martin.st>2019-01-23 08:25:28 +0000
commit12b6b802080e0000ce81c58aeb15b4a59290f86f (patch)
treea9f83e06bf77c840559032a036146fc23afcb87d /llvm/tools/llvm-objcopy/COFF/Object.h
parent3ff5dfd7359de4a6e272ab87b96d1e73b1e57469 (diff)
downloadbcm5719-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/Object.h')
-rw-r--r--llvm/tools/llvm-objcopy/COFF/Object.h26
1 files changed, 25 insertions, 1 deletions
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<uint8_t> Contents;
std::vector<Relocation> Relocs;
StringRef Name;
ssize_t UniqueId;
size_t Index;
+
+ ArrayRef<uint8_t> getContents() const {
+ if (!OwnedContents.empty())
+ return OwnedContents;
+ return ContentsRef;
+ }
+
+ void setContentsRef(ArrayRef<uint8_t> Data) {
+ OwnedContents.clear();
+ ContentsRef = Data;
+ }
+
+ void setOwnedContents(std::vector<uint8_t> &&Data) {
+ ContentsRef = ArrayRef<uint8_t>();
+ OwnedContents = std::move(Data);
+ }
+
+ void clearContents() {
+ ContentsRef = ArrayRef<uint8_t>();
+ OwnedContents.clear();
+ }
+
+private:
+ ArrayRef<uint8_t> ContentsRef;
+ std::vector<uint8_t> OwnedContents;
};
struct Symbol {
OpenPOWER on IntegriCloud