From fe0f8885d7ec2b6693a2854712e7a751506ad650 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jul 2019 18:34:55 -0700 Subject: [PATCH] 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. --- cmake/modules/SwiftSupport.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake index ead1958b8..ebdfd5d92 100644 --- a/cmake/modules/SwiftSupport.cmake +++ b/cmake/modules/SwiftSupport.cmake @@ -133,7 +133,11 @@ function(add_swift_target target) endif() if(AST_LIBRARY) - set(emit_library -emit-library) + if(CMAKE_SYSTEM_NAME STREQUAL Windows OR CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(emit_library -emit-library) + else() + set(emit_library -emit-library -Xlinker -soname -Xlinker ${AST_OUTPUT}) + endif() endif() if(NOT AST_LIBRARY OR library_kind STREQUAL SHARED) add_custom_command(OUTPUT