mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[autolink-extract] Support (and ignore) LLVM IR files. (#71142)
In Linux, the current implementation of swift-autolink-extract does not support LLVM IR files resulting from using LTO. If one tries to build LLVM using LTO and then try to link one of the targets that use `swiftc` to link, but link against LLVM object files (like `swift-plugin-server`), `swift-autolink-extract` will fail saying that some object files are not valid. To deal with LLVM IR files correctly, create and pass a `llvm::LLVMContext` around, which allows the APIs in `llvm::object` to read LLVM IR files. Additionally, handle the case of `IRObjectFile` when extracting, but perform no action.
This commit is contained in:
committed by
GitHub
parent
c527b0ff39
commit
b43d01ff7f
7
test/AutolinkExtract/llvm-ir.cpp
Normal file
7
test/AutolinkExtract/llvm-ir.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
// REQUIRES: autolink-extract
|
||||
// RUN: %clang -flto=thin -c -o - %s | %target-swift-autolink-extract -o - - 2>&1 | %FileCheck --allow-empty %s
|
||||
// CHECK-NOT: The file was not recognized as a valid object file
|
||||
|
||||
int test() {
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user