diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-07-16 00:11:09 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-07-16 20:25:51 -0700 |
| commit | 74e198126b19efb7871aa673ae17483753f067b0 (patch) | |
| tree | 29ecd1434421fc39bd3e56f0fa2f8278978803b7 /src/rustllvm/ArchiveWrapper.cpp | |
| parent | 7f0e733f1d8e597faee4bff0fc04838867725fad (diff) | |
| download | rust-74e198126b19efb7871aa673ae17483753f067b0.tar.gz rust-74e198126b19efb7871aa673ae17483753f067b0.zip | |
trans: Add kind to writeArchive
Updates our LLVM bindings to be able to write out multiple kinds of archives. This commit also enables using LLVM instead of the system ar on all current targets.
Diffstat (limited to 'src/rustllvm/ArchiveWrapper.cpp')
| -rw-r--r-- | src/rustllvm/ArchiveWrapper.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp index 2e94c196935..86225874df7 100644 --- a/src/rustllvm/ArchiveWrapper.cpp +++ b/src/rustllvm/ArchiveWrapper.cpp @@ -120,7 +120,17 @@ LLVMRustArchiveChildName(const Archive::Child *child, size_t *size) { extern "C" const char* LLVMRustArchiveChildData(Archive::Child *child, size_t *size) { - StringRef buf = child->getBuffer(); + StringRef buf; +#if LLVM_VERSION_MINOR >= 7 + ErrorOr<StringRef> buf_or_err = child->getBuffer(); + if (buf_or_err.getError()) { + LLVMRustSetLastError(buf_or_err.getError().message().c_str()); + return NULL; + } + buf = buf_or_err.get(); +#else + buf = child->getBuffer(); +#endif *size = buf.size(); return buf.data(); } @@ -144,7 +154,8 @@ extern "C" int LLVMRustWriteArchive(char *Dst, size_t NumMembers, const LLVMRustArchiveMember **NewMembers, - bool WriteSymbtab) { + bool WriteSymbtab, + Archive::Kind Kind) { #if LLVM_VERSION_MINOR >= 7 std::vector<NewArchiveIterator> Members; @@ -157,7 +168,7 @@ LLVMRustWriteArchive(char *Dst, Members.push_back(NewArchiveIterator(Member->child, Member->name)); } } - auto pair = writeArchive(Dst, Members, WriteSymbtab); + auto pair = writeArchive(Dst, Members, WriteSymbtab, Kind, false); if (!pair.second) return 0; LLVMRustSetLastError(pair.second.message().c_str()); |
