aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-12-19 07:24:38 +0000
committerMartin Storsjo <martin@martin.st>2018-12-19 07:24:38 +0000
commite84a0b5a9e2c8003dc857f2760134e36df1e9987 (patch)
treeaecebf768c7a3199e49d042918208e424327118a /llvm/tools/llvm-objcopy/llvm-objcopy.cpp
parent642e140bebe0825168078f15b992e604b6af4e81 (diff)
downloadllvm-e84a0b5a9e2c8003dc857f2760134e36df1e9987.zip
llvm-e84a0b5a9e2c8003dc857f2760134e36df1e9987.tar.gz
llvm-e84a0b5a9e2c8003dc857f2760134e36df1e9987.tar.bz2
[llvm-objcopy] Initial COFF support
This is an initial implementation of no-op passthrough copying of COFF with objcopy. Differential Revision: https://reviews.llvm.org/D54939 llvm-svn: 349605
Diffstat (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
-rw-r--r--llvm/tools/llvm-objcopy/llvm-objcopy.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index bc50880..fb1ff18 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -9,6 +9,7 @@
#include "llvm-objcopy.h"
#include "Buffer.h"
+#include "COFF/COFFObjcopy.h"
#include "CopyConfig.h"
#include "ELF/ELFObjcopy.h"
@@ -19,6 +20,7 @@
#include "llvm/Object/Archive.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/Binary.h"
+#include "llvm/Object/COFF.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/ELFTypes.h"
#include "llvm/Object/Error.h"
@@ -125,6 +127,8 @@ static void executeObjcopyOnBinary(const CopyConfig &Config, object::Binary &In,
Buffer &Out) {
if (auto *ELFBinary = dyn_cast<object::ELFObjectFileBase>(&In))
return elf::executeObjcopyOnBinary(Config, *ELFBinary, Out);
+ else if (auto *COFFBinary = dyn_cast<object::COFFObjectFile>(&In))
+ return coff::executeObjcopyOnBinary(Config, *COFFBinary, Out);
else
error("Unsupported object file format");
}