mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-24 04:34:17 +08:00
b406f28746
Partial RELRO means that the object is GNU_RELRO but not BIND_NOW. This reduces the effectiveness of RELRO. bluez triggers this because it enables PIE during the build, and rpmdiff takes this as an indicator that the best possible hardening is desired. https://bugzilla.redhat.com/show_bug.cgi?id=983161
63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
AC_DEFUN([AC_PROG_CC_PIE], [
|
|
AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
|
|
echo 'void f(){}' > conftest.c
|
|
if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
|
|
ac_cv_prog_cc_pie=yes
|
|
else
|
|
ac_cv_prog_cc_pie=no
|
|
fi
|
|
rm -rf conftest*
|
|
])
|
|
])
|
|
|
|
AC_DEFUN([COMPILER_FLAGS], [
|
|
with_cflags=""
|
|
if (test "$USE_MAINTAINER_MODE" = "yes"); then
|
|
with_cflags="$with_cflags -Wall -Werror -Wextra"
|
|
with_cflags="$with_cflags -Wno-unused-parameter"
|
|
with_cflags="$with_cflags -Wno-missing-field-initializers"
|
|
with_cflags="$with_cflags -Wdeclaration-after-statement"
|
|
with_cflags="$with_cflags -Wmissing-declarations"
|
|
with_cflags="$with_cflags -Wredundant-decls"
|
|
with_cflags="$with_cflags -Wcast-align"
|
|
with_cflags="$with_cflags -Wswitch-enum"
|
|
with_cflags="$with_cflags -Wformat -Wformat-security"
|
|
with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
|
|
with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
|
|
with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
|
|
fi
|
|
AC_SUBST([WARNING_CFLAGS], $with_cflags)
|
|
])
|
|
|
|
AC_DEFUN([MISC_FLAGS], [
|
|
misc_cflags=""
|
|
misc_ldflags=""
|
|
AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
|
|
[disable code optimization through compiler]), [
|
|
if (test "${enableval}" = "no"); then
|
|
misc_cflags="$misc_cflags -O0"
|
|
fi
|
|
])
|
|
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
|
|
[enable compiling with debugging information]), [
|
|
if (test "${enableval}" = "yes" &&
|
|
test "${ac_cv_prog_cc_g}" = "yes"); then
|
|
misc_cflags="$misc_cflags -g"
|
|
fi
|
|
])
|
|
AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
|
|
[enable position independent executables flag]), [
|
|
if (test "${enableval}" = "yes" &&
|
|
test "${ac_cv_prog_cc_pie}" = "yes"); then
|
|
misc_cflags="$misc_cflags -fPIC"
|
|
misc_ldflags="$misc_ldflags -pie -Wl,-z,now"
|
|
fi
|
|
])
|
|
if (test "$enable_coverage" = "yes"); then
|
|
misc_cflags="$misc_cflags --coverage"
|
|
misc_ldflags="$misc_ldflags --coverage"
|
|
fi
|
|
AC_SUBST([MISC_CFLAGS], $misc_cflags)
|
|
AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
|
|
])
|