Skip to content

Commit 83f0732

Browse files
committed
meson: Remove _FORTIFY_SOURCE
Distributions want to override _FORTIFY_SOURCE, and various libc implementations support different versions of it. This is causing us some headaches, and supporting major platforms unfortunately need to take priority. Remove _FORTIFY_SOURCE and instead try to set -fhardened, which we can easily detect, and enable a few extra errors for good measure. Reference: mesonbuild/meson#13024 Reference: ossf/wg-best-practices-os-developers#659
1 parent 4f51fcf commit 83f0732

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

meson.build

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ add_project_arguments(cc.get_supported_arguments(
5151
'-Wmissing-prototypes',
5252
'-Wno-unknown-warning-option',
5353
'-Wno-unused-command-line-argument',
54+
'-Werror=strict-aliasing',
55+
'-Werror=lto-type-mismatch',
56+
'-Werror=odr',
5457
'-Wvla',
58+
# GCC warns if hardened is used without optimization
59+
'-Wno-hardened',
60+
'-fhardened',
5561
]),
5662
language: 'c',
5763
)
@@ -63,10 +69,6 @@ add_project_arguments(cc.get_supported_link_arguments(
6369
language: 'c',
6470
)
6571

66-
if ['debugoptimized', 'release', 'minsize'].contains(get_option('buildtype'))
67-
add_project_arguments('-D_FORTIFY_SOURCE=2', language: 'c')
68-
endif
69-
7072
if get_option('buildtype').startswith('debug')
7173
add_project_arguments('-DDEBUG', language : 'c')
7274
endif

0 commit comments

Comments
 (0)