mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
Add noexecstack flag for gcc/clang C and CPP in Meson
The `-Wl,-z,noexecstack` and `-Wa,--noexecstack` flags are already set for CMake, but not for Meson. This brings the flags to the Meson build as well. Note that this maintains the discrepancy in behavior between CMake and Meson when it comes to enabling ASM: on CMake, the ZSTD_HAS_NOEXECSTACK variable is set and these flags added for GCC/Clang and MinGW. Then later, the ZSTD_HAS_NOEXECSTACK variable is checked (along with some other conditions) to enable or disable ASM. However on Meson, this logic is restricted to simply checking for GCC/Clang. This patch maintains this behavior; noexecstack is dependent on GCC/Clang only.
This commit is contained in:
parent
26a2b5d5df
commit
7b856e3028
1 changed files with 8 additions and 2 deletions
|
|
@ -116,10 +116,16 @@ if [compiler_gcc, compiler_clang].contains(cc_id)
|
|||
if cc_id == compiler_clang
|
||||
common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation']
|
||||
endif
|
||||
cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes'])
|
||||
cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags)
|
||||
noexecstack_flags = ['-Wa,--noexecstack' ]
|
||||
noexecstack_link_flags = ['-Wl,-z,noexecstack']
|
||||
cc_compile_flags = cc.get_supported_arguments(common_warning_flags + noexecstack_flags + ['-Wstrict-prototypes'])
|
||||
cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags + noexecstack_flags)
|
||||
add_project_arguments(cc_compile_flags, language : 'c')
|
||||
add_project_arguments(cxx_compile_flags, language : 'cpp')
|
||||
cc_link_flags = cc.get_supported_link_arguments(noexecstack_link_flags)
|
||||
cxx_link_flags = cxx.get_supported_link_arguments(noexecstack_link_flags)
|
||||
add_project_link_arguments(cc_link_flags, language: 'c')
|
||||
add_project_link_arguments(cxx_link_flags, language: 'cpp')
|
||||
elif cc_id == compiler_msvc
|
||||
msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ]
|
||||
if use_multi_thread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue