build: Enable -fno-strict-aliasing

GLib makes various assumptions about aliasing throughout its codebase,
and compiling with -fstrict-aliasing has been demonstrated to cause
problems (for example, bug #791622). Explicitly disable strict aliasing
as a result.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2017-12-21 17:49:05 +00:00
parent 97d24b93ab
commit ade324f6fa
2 changed files with 12 additions and 0 deletions

View File

@ -2630,6 +2630,14 @@ AS_IF([ test "x$use_gcov" = "xyes"], [
LDFLAGS="$LDFLAGS -lgcov"
])
dnl *******************************
dnl *** Disable strict aliasing ***
dnl *******************************
dnl See https://bugzilla.gnome.org/show_bug.cgi?id=791622
AS_IF([test "${GCC}" = "yes"],[
CFLAGS="$CFLAGS -fno-strict-aliasing"
])
dnl ******************************
dnl *** output the whole stuff ***
dnl ******************************

View File

@ -63,6 +63,10 @@ glib_pkgconfigreldir = join_paths(glib_libdir, 'pkgconfig')
add_project_arguments('-D_GNU_SOURCE', language: 'c')
# Disable strict aliasing;
# see https://bugzilla.gnome.org/show_bug.cgi?id=791622
add_project_arguments('-fno-strict-aliasing', language: 'c')
########################
# Configuration begins #
########################