Skip to content

Commit 8c8cda4

Browse files
compnerdrokhinip
authored andcommitted
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. Signed-off-by: Kim Topley <[email protected]>
1 parent 5cc8569 commit 8c8cda4

File tree

2 files changed

+5
-1
lines changed

2 files 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
File renamed without changes.

0 commit comments

Comments
 (0)