summaryrefslogtreecommitdiff
path: root/tools/llvm-modextract/llvm-modextract.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-modextract/llvm-modextract.cpp')
-rw-r--r--tools/llvm-modextract/llvm-modextract.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/llvm-modextract/llvm-modextract.cpp b/tools/llvm-modextract/llvm-modextract.cpp
index 6c2e364be448c..58cede1374ea5 100644
--- a/tools/llvm-modextract/llvm-modextract.cpp
+++ b/tools/llvm-modextract/llvm-modextract.cpp
@@ -59,9 +59,12 @@ int main(int argc, char **argv) {
ExitOnErr(errorCodeToError(EC));
if (BinaryExtract) {
- SmallVector<char, 0> Header;
- BitcodeWriter Writer(Header);
- Out->os() << Header << Ms[ModuleIndex].getBuffer();
+ SmallVector<char, 0> Result;
+ BitcodeWriter Writer(Result);
+ Result.append(Ms[ModuleIndex].getBuffer().begin(),
+ Ms[ModuleIndex].getBuffer().end());
+ Writer.copyStrtab(Ms[ModuleIndex].getStrtab());
+ Out->os() << Result;
Out->keep();
return 0;
}