Skip to content

Commit

Permalink
Merge pull request #4284 from facebook/mesonNoexec
Browse files Browse the repository at this point in the history
Add noexecstack flag for gcc/clang C and CPP in Meson
  • Loading branch information
Cyan4973 authored Feb 6, 2025
2 parents ef2bf57 + 7b856e3 commit 0396480
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build/meson/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0396480

Please sign in to comment.