Skip to content

Commit

Permalink
meson: Improve hardening flags
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuhn committed Jun 29, 2024
1 parent ceba9f0 commit 306d971
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ project('julea', 'c',
cc = meson.get_compiler('c')
pkg_config = import('pkgconfig')

cc_args = cc.get_supported_arguments([
'-fno-omit-frame-pointer',
'-fhardened',
])

if get_option('debug')
args = cc.get_supported_arguments([
'-fno-omit-frame-pointer',
'-fstack-protector-strong',
cc_args += cc.get_supported_arguments([
'-Waggregate-return',
'-Wcast-align=strict',
'-Wcast-qual',
Expand Down Expand Up @@ -69,10 +72,10 @@ if get_option('debug')
'-Wuninitialized',
'-Wwrite-strings',
])

add_project_arguments(args, language: 'c')
endif

add_project_arguments(cc_args, language: 'c')

sanitize_cflags = ''

if get_option('b_sanitize') != 'none'
Expand Down Expand Up @@ -321,7 +324,6 @@ julea_conf.set_quoted('G_LOG_DOMAIN', 'JULEA')
julea_conf.set_quoted('JULEA_BACKEND_PATH', get_option('prefix') / get_option('libdir') / 'julea' / 'backend')

if get_option('debug')
julea_conf.set('_FORTIFY_SOURCE', 2)
julea_conf.set('JULEA_DEBUG', 1)
julea_conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_@0@'.format(glib_version.underscorify()))
#julea_conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_@0@'.format(glib_version.underscorify()))
Expand Down

0 comments on commit 306d971

Please sign in to comment.