mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 01:50:25 +01:00
build: garbage collect unused symbols by default
GCC can place each symbols into separate sections making it possible for
ld to discard unneeded sections (and thus symbols afterwards). This achieves
almost the same size benefits as LTO without the huge performance
penalty (and the undefined behavior with -g).
The cost of more section headers in .o files seems to be negligible.
Before:
359.73user 71.94system 1:29.67elapsed 481%CPU (0avgtext+0avgdata 137948maxresident)k
text data bss dec hex filename
2772228 74848 9272 2856348 2b959c src/NetworkManager
With LTO:
740.37user 94.89system 4:13.83elapsed 329%CPU (0avgtext+0avgdata 118316maxresident)k
text data bss dec hex filename
2435437 74224 8704 2518365 266d5d src/NetworkManager
With --gc-sections:
365.63user 72.34system 1:30.12elapsed 485%CPU (0avgtext+0avgdata 138016maxresident)k
text data bss dec hex filename
2498498 74040 8408 2580946 2761d2 src/NetworkManager
This commit is contained in:
parent
6d91c14b00
commit
c8f65e95fd
1 changed files with 11 additions and 0 deletions
11
configure.ac
11
configure.ac
|
|
@ -935,6 +935,16 @@ else
|
|||
enable_lto='no'
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(ld-gc, AS_HELP_STRING([--enable-ld-gc], [Enable garbage collection of unused symbols on linking (default: auto)]))
|
||||
if (test "${enable_ld_gc}" != "no"); then
|
||||
NM_COMPILER_FLAG([-fdata-sections -ffunction-sections -Wl,--gc-sections], [enable_ld_gc='yes'], [
|
||||
if (test "${enable_ld_gc}" = "yes"); then
|
||||
AC_MSG_ERROR([Unused symbol eviction requested but not supported.])
|
||||
else
|
||||
enable_ld_gc='no'
|
||||
fi
|
||||
])
|
||||
fi
|
||||
|
||||
dnl -------------------------
|
||||
dnl Vala bindings
|
||||
|
|
@ -1194,5 +1204,6 @@ echo " more-asserts: $more_asserts"
|
|||
echo " valgrind: $with_valgrind $with_valgrind_suppressions"
|
||||
echo " code coverage: $enable_code_coverage"
|
||||
echo " LTO: $enable_lto"
|
||||
echo " linker garbage collection: $enable_ld_gc"
|
||||
echo " JSON validation: $enable_json_validation"
|
||||
echo
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue