Skip to content

Commit 2594742

Browse files
committed
[FIXUP] cmake: Do not apply hardening flags to libsecp256k1 C code
This change mirrors the master branch behavior.
1 parent 0e6def0 commit 2594742

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,11 @@ endif()
321321
include(AddThreadsIfNeeded)
322322
add_threads_if_needed()
323323

324-
add_library(sanitizing_interface INTERFACE)
325-
target_link_libraries(core_base_interface INTERFACE sanitizing_interface)
326324
if(SANITIZERS)
327325
# First check if the compiler accepts flags. If an incompatible pair like
328326
# -fsanitize=address,thread is used here, this check will fail. This will also
329327
# fail if a bad argument is passed, e.g. -fsanitize=undfeined
330-
try_append_cxx_flags("-fsanitize=${SANITIZERS}" TARGET sanitizing_interface
328+
try_append_cxx_flags("-fsanitize=${SANITIZERS}" TARGET core_base_interface
331329
RESULT_VAR cxx_supports_sanitizers
332330
SKIP_LINK
333331
)
@@ -354,7 +352,7 @@ if(SANITIZERS)
354352
message(FATAL_ERROR "Linker did not accept requested flags, you are missing required libraries.")
355353
endif()
356354
endif()
357-
target_link_options(sanitizing_interface INTERFACE ${SANITIZER_LDFLAGS})
355+
target_link_options(core_base_interface INTERFACE ${SANITIZER_LDFLAGS})
358356

359357
include(AddBoostIfNeeded)
360358
add_boost_if_needed()
@@ -497,7 +495,7 @@ try_append_cxx_flags("-fstack-reuse=none" TARGET core_base_interface)
497495

498496
if(ENABLE_HARDENING)
499497
add_library(hardening_interface INTERFACE)
500-
target_link_libraries(core_base_interface INTERFACE hardening_interface)
498+
target_link_libraries(core_interface INTERFACE hardening_interface)
501499
if(MSVC)
502500
try_append_linker_flag("/DYNAMICBASE" TARGET hardening_interface)
503501
try_append_linker_flag("/HIGHENTROPYVA" TARGET hardening_interface)

cmake/crc32c.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ target_compile_definitions(crc32c_common INTERFACE
8585
HAVE_STRONG_GETAUXVAL=$<BOOL:${HAVE_STRONG_GETAUXVAL}>
8686
BYTE_ORDER_BIG_ENDIAN=$<STREQUAL:${CMAKE_CXX_BYTE_ORDER},BIG_ENDIAN>
8787
)
88-
target_link_libraries(crc32c_common INTERFACE core_base_interface)
88+
target_link_libraries(crc32c_common INTERFACE
89+
core_base_interface
90+
hardening_interface
91+
)
8992

9093
add_library(crc32c STATIC EXCLUDE_FROM_ALL
9194
${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c.cc

cmake/leveldb.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ endif()
9696

9797
target_link_libraries(leveldb PRIVATE
9898
core_base_interface
99+
hardening_interface
99100
nowarn_leveldb_interface
100101
crc32c
101102
)

cmake/minisketch.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if(HAVE_CLMUL)
5555
target_link_libraries(minisketch_clmul
5656
PRIVATE
5757
core_base_interface
58+
hardening_interface
5859
minisketch_common
5960
)
6061
set_target_properties(minisketch_clmul PROPERTIES
@@ -82,6 +83,7 @@ target_include_directories(minisketch
8283
target_link_libraries(minisketch
8384
PRIVATE
8485
core_base_interface
86+
hardening_interface
8587
minisketch_common
8688
$<TARGET_NAME_IF_EXISTS:minisketch_clmul>
8789
)

0 commit comments

Comments
 (0)