build: bump m4 to use data-sections, func-sections

This commit is contained in:
Danny Robson 2015-03-18 17:14:58 +11:00
parent 5674f2a2e9
commit dc8fd96e4b

View File

@ -7,6 +7,8 @@ AC_DEFUN([NC_OPTIMISATION],[
AX_COMPILER_VENDOR AX_COMPILER_VENDOR
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
## Enable LTO
AC_ARG_ENABLE([lto], [ AC_ARG_ENABLE([lto], [
AS_HELP_STRING([--enable-lto], [enable link-time optimisation]) AS_HELP_STRING([--enable-lto], [enable link-time optimisation])
]) ])
@ -28,6 +30,8 @@ AC_DEFUN([NC_OPTIMISATION],[
]) ])
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
## Choose the most performant processor architecture and features
AC_CANONICAL_HOST AC_CANONICAL_HOST
AS_CASE([$host_cpu], AS_CASE([$host_cpu],
@ -50,6 +54,9 @@ AC_DEFUN([NC_OPTIMISATION],[
AX_APPEND_COMPILE_FLAGS([-mfpmath=sse], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-mfpmath=sse], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msahf], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-msahf], [], [-Werror])
##-------------------------------------------------------------------------
## Enable aggressive code generation optimisations
AS_IF([test "x$enable_debugging" != "xyes"], [ AS_IF([test "x$enable_debugging" != "xyes"], [
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror])
@ -60,4 +67,15 @@ AC_DEFUN([NC_OPTIMISATION],[
# performance than security. # performance than security.
AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror])
]) ])
##-------------------------------------------------------------------------
## Enable code size optimisations (that don't impact performance)
## Note: we assume CXX, and that CXXLINK is g++ not ld, hence the -Wl opt
AS_IF([test "x$enable_debugging" != "xyes"], [
AX_CHECK_LINK_FLAG([-Wl,--gc-sections], [
AX_APPEND_COMPILE_FLAGS([-fdata-sections], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ffunction-sections], [], [-Werror])
AX_APPEND_LINK_FLAGS([-Wl,--gc-sections], [], [-Werror])
])
])
]) ])