File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -533,7 +533,19 @@ if(ENABLE_HARDENING)
533
533
try_append_linker_flag ("-Wl,--high-entropy-va" TARGET hardening_interface )
534
534
try_append_linker_flag ("-Wl,-z,relro" TARGET hardening_interface )
535
535
try_append_linker_flag ("-Wl,-z,now" TARGET hardening_interface )
536
- try_append_linker_flag ("-Wl,-z,separate-code" TARGET hardening_interface )
536
+ # TODO: This can be dropped once Bitcoin Core no longer supports
537
+ # NetBSD 10.0 or if upstream fix is backported.
538
+ # NetBSD's dynamic linker ld.elf_so < 11.0 supports exactly 2
539
+ # `PT_LOAD` segments and binaries linked with `-z separate-code`
540
+ # have 4 `PT_LOAD` segments.
541
+ # Relevant discussions:
542
+ # - https://github.com/bitcoin/bitcoin/pull/28724#issuecomment-2589347934
543
+ # - https://mail-index.netbsd.org/tech-userlevel/2023/01/05/msg013666.html
544
+ if (CMAKE_SYSTEM_NAME STREQUAL "NetBSD" AND CMAKE_SYSTEM_VERSION VERSION_LESS 11.0 )
545
+ try_append_linker_flag ("-Wl,-z,noseparate-code" TARGET hardening_interface )
546
+ else ()
547
+ try_append_linker_flag ("-Wl,-z,separate-code" TARGET hardening_interface )
548
+ endif ()
537
549
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
538
550
try_append_linker_flag ("-Wl,-fixup_chains" TARGET hardening_interface )
539
551
endif ()
You can’t perform that action at this time.
0 commit comments