Skip to content

Commit e85f6a0

Browse files
authored
Merge pull request swiftlang#832 from al45tair/eng/PR-130582819
[Linux] Enable build IDs.
2 parents 30bb801 + 8e43e3e commit e85f6a0

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ include(CheckCSourceCompiles)
122122
include(CheckFunctionExists)
123123
include(CheckIncludeFiles)
124124
include(CheckLibraryExists)
125+
include(CheckLinkerFlag)
125126
include(CheckSymbolExists)
126127
include(GNUInstallDirs)
127128
include(CTest)
@@ -175,6 +176,8 @@ option(ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via _Th
175176
set(DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE})
176177

177178

179+
check_linker_flag(C "LINKER:--build-id=sha1" LINKER_SUPPORTS_BUILD_ID)
180+
178181
check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
179182
if(_GNU_SOURCE)
180183
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE)

src/BlocksRuntime/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ endif()
2222
set_target_properties(BlocksRuntime PROPERTIES
2323
POSITION_INDEPENDENT_CODE TRUE)
2424

25+
if(LINKER_SUPPORTS_BUILD_ID)
26+
target_link_options(BlocksRuntime PRIVATE "LINKER:--build-id=sha1")
27+
endif()
28+
2529
add_library(BlocksRuntime::BlocksRuntime ALIAS BlocksRuntime)
2630

2731
install(FILES Block.h

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
178178
set_target_properties(dispatch PROPERTIES INSTALL_RPATH "$ORIGIN")
179179
endif()
180180

181+
if(LINKER_SUPPORTS_BUILD_ID)
182+
target_link_options(dispatch PRIVATE "LINKER:--build-id=sha1")
183+
endif()
184+
181185
if(ENABLE_SWIFT)
182186
add_subdirectory(swift)
183187
endif()

0 commit comments

Comments
 (0)