linker: ld: lld: do not do RELRO when using llvm/clang
GNU ld and LLVM lld both complain under C++: error: section: init_array is not contiguous with other relro sections So do not create RELRO program header. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
81c3b3152c
commit
5d9079ba6d
2 changed files with 20 additions and 0 deletions
|
|
@ -39,4 +39,14 @@ macro(toolchain_ld_base)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_CPP AND (CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||||
|
# GNU ld complains when used with llvm/clang:
|
||||||
|
# error: section: init_array is not contiguous with other relro sections
|
||||||
|
#
|
||||||
|
# So do not create RELRO program header.
|
||||||
|
zephyr_link_libraries(
|
||||||
|
-Wl,-z,norelro
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,16 @@ macro(toolchain_ld_base)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_CPP)
|
||||||
|
# LLVM lld complains:
|
||||||
|
# error: section: init_array is not contiguous with other relro sections
|
||||||
|
#
|
||||||
|
# So do not create RELRO program header.
|
||||||
|
zephyr_link_libraries(
|
||||||
|
-Wl,-z,norelro
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
zephyr_link_libraries(
|
zephyr_link_libraries(
|
||||||
--config ${ZEPHYR_BASE}/cmake/toolchain/llvm/clang.cfg
|
--config ${ZEPHYR_BASE}/cmake/toolchain/llvm/clang.cfg
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue