diff options
| author | Tshepang Mbambo <hopsi@tuta.io> | 2025-08-02 00:40:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-02 00:40:01 +0200 |
| commit | 171c2478c06da00fb010cc77c333d328410ee796 (patch) | |
| tree | e32965651228b69cc5cf14ad47e7e762c8ed7483 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 219e4c141dd62e8f026312746fe3d7be0569151f (diff) | |
| parent | 7cab27d73ab228be6a1eface8f0cb2f3c3b76c7c (diff) | |
| download | rust-171c2478c06da00fb010cc77c333d328410ee796.tar.gz rust-171c2478c06da00fb010cc77c333d328410ee796.zip | |
Merge pull request #2526 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index a2e4d7306cb..8c34052770e 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -1650,40 +1650,6 @@ extern "C" LLVMModuleRef LLVMRustParseBitcodeForLTO(LLVMContextRef Context, return wrap(std::move(*SrcOrError).release()); } -// Find a section of an object file by name. Fail if the section is missing or -// empty. -extern "C" const char *LLVMRustGetSliceFromObjectDataByName(const char *data, - size_t len, - const char *name, - size_t name_len, - size_t *out_len) { - *out_len = 0; - auto Name = StringRef(name, name_len); - auto Data = StringRef(data, len); - auto Buffer = MemoryBufferRef(Data, ""); // The id is unused. - file_magic Type = identify_magic(Buffer.getBuffer()); - Expected<std::unique_ptr<object::ObjectFile>> ObjFileOrError = - object::ObjectFile::createObjectFile(Buffer, Type); - if (!ObjFileOrError) { - LLVMRustSetLastError(toString(ObjFileOrError.takeError()).c_str()); - return nullptr; - } - for (const object::SectionRef &Sec : (*ObjFileOrError)->sections()) { - Expected<StringRef> SecName = Sec.getName(); - if (SecName && *SecName == Name) { - Expected<StringRef> SectionOrError = Sec.getContents(); - if (!SectionOrError) { - LLVMRustSetLastError(toString(SectionOrError.takeError()).c_str()); - return nullptr; - } - *out_len = SectionOrError->size(); - return SectionOrError->data(); - } - } - LLVMRustSetLastError("could not find requested section"); - return nullptr; -} - // Computes the LTO cache key for the provided 'ModId' in the given 'Data', // storing the result in 'KeyOut'. // Currently, this cache key is a SHA-1 hash of anything that could affect |
