aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2020-01-29 17:30:57 -0800
committerDerek Schuff <dschuff@chromium.org>2020-01-29 17:32:02 -0800
commitf2af0607000cb18bf9292457ea247bb6602b4cdb (patch)
tree5779fa8a22267a1aecfdc917652d8d0dc1bc62eb /llvm/tools/llvm-objcopy/llvm-objcopy.cpp
parent93cdd310e16ec57efd4a93886dd3b71ea4cf8183 (diff)
downloadllvm-f2af0607000cb18bf9292457ea247bb6602b4cdb.zip
llvm-f2af0607000cb18bf9292457ea247bb6602b4cdb.tar.gz
llvm-f2af0607000cb18bf9292457ea247bb6602b4cdb.tar.bz2
[llvm-objcopy] Initial support for wasm in llvm-objcopy
Currently only supports simple copying, other operations to follow. Reviewers: sbc100, alexshap, jhenderson Differential Revision: https://reviews.llvm.org/D70930 This is a reland of a928d127a with a one-line fix to ensure that the wasm version number is written as little-endian (it's the only field in all of the binary format that's not a single byte or an LEB, but we may have to watch out more when we start handling the linking section).
Diffstat (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
-rw-r--r--llvm/tools/llvm-objcopy/llvm-objcopy.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index e662f35..61efc74 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -8,10 +8,11 @@
#include "llvm-objcopy.h"
#include "Buffer.h"
+#include "COFF/COFFObjcopy.h"
#include "CopyConfig.h"
#include "ELF/ELFObjcopy.h"
-#include "COFF/COFFObjcopy.h"
#include "MachO/MachOObjcopy.h"
+#include "wasm/WasmObjcopy.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
@@ -25,6 +26,7 @@
#include "llvm/Object/ELFTypes.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/MachO.h"
+#include "llvm/Object/Wasm.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
@@ -172,6 +174,8 @@ static Error executeObjcopyOnBinary(CopyConfig &Config, object::Binary &In,
return coff::executeObjcopyOnBinary(Config, *COFFBinary, Out);
else if (auto *MachOBinary = dyn_cast<object::MachOObjectFile>(&In))
return macho::executeObjcopyOnBinary(Config, *MachOBinary, Out);
+ else if (auto *WasmBinary = dyn_cast<object::WasmObjectFile>(&In))
+ return objcopy::wasm::executeObjcopyOnBinary(Config, *WasmBinary, Out);
else
return createStringError(object_error::invalid_file_type,
"unsupported object file format");