Skip to content

Commit fe0f888

Browse files
committed
build: add DT_SONAME for ELF libraries
ELF libraries should have DT_SONAME set so that they can be loaded properly. This is needed currently since we do not use proper CMake support for Swift and that requires that we pass along the `-soname` flag to the linker ourselves. Account for that. This improves loading of swiftDispatch on android.
1 parent d9740c2 commit fe0f888

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/modules/SwiftSupport.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ function(add_swift_target target)
133133
endif()
134134

135135
if(AST_LIBRARY)
136-
set(emit_library -emit-library)
136+
if(CMAKE_SYSTEM_NAME STREQUAL Windows OR CMAKE_SYSTEM_NAME STREQUAL Darwin)
137+
set(emit_library -emit-library)
138+
else()
139+
set(emit_library -emit-library -Xlinker -soname -Xlinker ${AST_OUTPUT})
140+
endif()
137141
endif()
138142
if(NOT AST_LIBRARY OR library_kind STREQUAL SHARED)
139143
add_custom_command(OUTPUT

0 commit comments

Comments
 (0)