Skip to content

Commit d30af4c

Browse files
[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: #77771.
1 parent 4822920 commit d30af4c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

test/Frontend/load-pass-plugin.swift

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
// REQUIRES: OS=macosx
22

3-
// This test fails under ASAN because of an ODR violation (which is strictly
4-
// speaking a bug: https://github.com/swiftlang/swift/issues/77771). Disable
5-
// for ASAN until it's fixed.
6-
// UNSUPPORTED: asan
7-
83
// RUN: %target-swift-frontend -load-pass-plugin=nonexistent.dylib %s -emit-ir -o /dev/null 2>&1 | %FileCheck -check-prefix=CHECK-UNABLE-LOAD %s
94
// CHECK-UNABLE-LOAD: error: unable to load plugin 'nonexistent.dylib': 'Could not load library{{.*}}'
105

116
// RUN: %empty-directory(%t)
127
// RUN: %target-clangxx %S/Inputs/TestPlugin.cpp -std=c++17 -stdlib=libc++ \
13-
// RUN: -isysroot %sdk -I %llvm_src_root/include -I %llvm_obj_root/include -L %llvm_obj_root/lib -lLLVMSupport \
14-
// RUN: -Wl,-undefined -Wl,suppress -Wl,-flat_namespace \
8+
// RUN: -isysroot %sdk -I %llvm_src_root/include -I %llvm_obj_root/include -L %llvm_obj_root/lib \
9+
// RUN: -Wl,-hidden-lLLVMSupport -Wl,-undefined -Wl,dynamic_lookup -Wl,-flat_namespace \
1510
// RUN: -dynamiclib -o %t/libTestPlugin.dylib
1611

1712
// RUN: %target-swift-frontend -load-pass-plugin=%t/libTestPlugin.dylib %s -emit-ir -o /dev/null 2>&1 | %swift-demangle | %FileCheck %s

0 commit comments

Comments
 (0)