diff options
| author | bors <bors@rust-lang.org> | 2024-08-15 14:13:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-15 14:13:52 +0000 |
| commit | d2b5aa6552c8acf67f38a2ad92062a32ec542f08 (patch) | |
| tree | 1899813d951bc263c5828d2e81de1ee228b84e25 /compiler/rustc_llvm/llvm-wrapper | |
| parent | 3139ff09e9d07f7700f8d15ed25a231e29c43627 (diff) | |
| parent | 901c9daa05ec817c3a0f7aad87a928cfcfe00ce2 (diff) | |
| download | rust-d2b5aa6552c8acf67f38a2ad92062a32ec542f08.tar.gz rust-d2b5aa6552c8acf67f38a2ad92062a32ec542f08.zip | |
Auto merge of #128936 - bjorn3:fix_thin_archive_reading, r=jieyouxu
Support reading thin archives in ArArchiveBuilder And switch to using ArArchiveBuilder with the LLVM backend too now that all regressions are fixed. Fixes https://github.com/rust-lang/rust/issues/107407 Fixes https://github.com/rust-lang/rust/issues/107162 https://github.com/rust-lang/rust/issues/107495 has been fixed in a previous PR already.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp index ccf1a5429e2..d625935d925 100644 --- a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp @@ -77,22 +77,18 @@ LLVMRustGetSymbols(char *BufPtr, size_t BufLen, void *State, Expected<std::unique_ptr<object::SymbolicFile>> ObjOrErr = getSymbolicFile(Buf->getMemBufferRef(), Context); if (!ObjOrErr) { - Error E = ObjOrErr.takeError(); - SmallString<0> ErrorBuf; - auto Error = raw_svector_ostream(ErrorBuf); - Error << E << '\0'; - return ErrorCallback(Error.str().data()); + return ErrorCallback(toString(ObjOrErr.takeError()).c_str()); } std::unique_ptr<object::SymbolicFile> Obj = std::move(*ObjOrErr); + if (Obj == nullptr) { + return 0; + } for (const object::BasicSymbolRef &S : Obj->symbols()) { if (!isArchiveSymbol(S)) continue; if (Error E = S.printName(SymName)) { - SmallString<0> ErrorBuf; - auto Error = raw_svector_ostream(ErrorBuf); - Error << E << '\0'; - return ErrorCallback(Error.str().data()); + return ErrorCallback(toString(std::move(E)).c_str()); } SymName << '\0'; if (void *E = Callback(State, SymNameBuf.str().data())) { |
