From abf91bc5bc00cfaaf28afe5de31fe50ce6922038 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 6 Jun 2011 09:56:41 +0100 Subject: [PATCH] Turn off -ffunction-sections -fdata-sections -Wl,--gc-sections by default It's an obscure feature that is often broken in toolchains for less common architectures/OSs, and the size reduction turns out not to be particularly significant in practice, so it seems better to make it opt-in. Removing this feature altogether would result in a less targeted application of -Wl,--gc-sections when used: at the moment -Wl,--gc-sections is only applied within the bus directory (the only place it's likely to be useful) whereas if added to LDFLAGS by a packager, it would affect the entire package. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33466 --- configure.ac | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index a041c55..86714fb 100644 --- a/configure.ac +++ b/configure.ac @@ -1168,15 +1168,18 @@ dnl but prepending to CFLAGS (so the user can override it with later CFLAGS) dnl is the next best thing CFLAGS="$WARNING_CFLAGS $CFLAGS" -# Disabling gc-sections makes our binaries bigger, but some toolchains -# have known-broken support for it which discards sections that are needed. +# Enabling gc-sections makes our binaries smaller (about 300K smaller on +# x86-64), but makes our static library larger (again, by about 300K on +# x86-64), and some toolchains have known-broken support for it which discards +# sections that are needed. Before enabling this option, check that it works, +# and that the size reduction is significant, on your particular platform. # See https://bugs.freedesktop.org/show_bug.cgi?id=33466 SECTION_LDFLAGS= AC_ARG_ENABLE([gc-sections], - [AS_HELP_STRING([--disable-gc-sections], - [disable --gc-sections to work around broken toolchains])], + [AS_HELP_STRING([--enable-gc-sections], + [use -Wl,--gc-sections to make dbus executables smaller (gcc only)])], [enable_gc_sections=$enableval], - [enable_gc_sections=yes]) + [enable_gc_sections=no]) if test "x$GCC,$enable_gc_sections,$dbus_win" = xyes,yes,no; then save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" -- 1.7.5.3