Files
swift-mirror/test/Frontend/load-pass-plugin.swift
Antonio Frighetto d30af4ca87 [Frontend] Re-enable ASAN builds support in load-pass-plugin test (NFC)
`libTestPlugin.dylib` dynamic library was previously linking against
`libLLVMSupport.a`, which is already linked into the Swift compiler
binary. This caused multiple conflicting definitions of `LLVMSupport`
lib symbols, leading to ODR violations. This issue has been addressed
by linking against `libLLVMSupport` via `-hidden-lLLVMSupport` flag,
ensuring `libLLVMSupport` symbols remain hidden within the plugin,
preventing conflicts with those in the Swift compiler.

Fixes: https://github.com/swiftlang/swift/issues/77771.
2024-12-05 10:01:04 +01:00

17 lines
847 B
Swift

// REQUIRES: OS=macosx
// RUN: %target-swift-frontend -load-pass-plugin=nonexistent.dylib %s -emit-ir -o /dev/null 2>&1 | %FileCheck -check-prefix=CHECK-UNABLE-LOAD %s
// CHECK-UNABLE-LOAD: error: unable to load plugin 'nonexistent.dylib': 'Could not load library{{.*}}'
// RUN: %empty-directory(%t)
// RUN: %target-clangxx %S/Inputs/TestPlugin.cpp -std=c++17 -stdlib=libc++ \
// RUN: -isysroot %sdk -I %llvm_src_root/include -I %llvm_obj_root/include -L %llvm_obj_root/lib \
// RUN: -Wl,-hidden-lLLVMSupport -Wl,-undefined -Wl,dynamic_lookup -Wl,-flat_namespace \
// RUN: -dynamiclib -o %t/libTestPlugin.dylib
// RUN: %target-swift-frontend -load-pass-plugin=%t/libTestPlugin.dylib %s -emit-ir -o /dev/null 2>&1 | %swift-demangle | %FileCheck %s
// CHECK: TestPlugin: main
// CHECK: TestPlugin: null.empty() -> ()
func empty() {}