cmake: drop -rdynamic aka CMP0065 NEW
Prior to version 3.3 cmake would always use -rdynamic. That in itself causes all the internal symbols to be exported, increasing the binaries by 5-10% and making it impossible for the compiler to reason, optimise and discard unused code. The -rdynamic is useful in two cases: - having a third party module (say /usr/lib/foo/foobar.so) which is underlinked and depends on symbols from the main binary - apps like irssi, bash and zsh use that - uses the glibc backtrace, which relies on dlopen/dlsym to fetch the symbol data. Unwind is much better solution, since it replies on the DWARF data Our binaries do not use either of these - so drop the -rdynamic. The autotools build doesn't use it either. text data bss dec hex filename 229000 2120 4424 235544 39818 bsdcat -- before 208324 2120 4424 214868 34754 bsdcat -- after 1093939 12128 24176 1130243 113f03 bsdcpio -- before 1059181 12128 24176 1095485 10b73d bsdcpio -- after 1130091 14264 6608 1150963 118ff3 bsdtar -- before 1093690 14264 6608 1114562 1101c2 bsdtar -- after Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
1 parent
8d4d0b346f
commit
1b50bca40b
1 file changed
+3
@@ -1,5 +1,8 @@
|
||||
#
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
|
||||
if(POLICY CMP0065)
|
||||
cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables
|
||||
endif()
|
||||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW) #3.12.0 `find_package()`` uses ``<PackageName>_ROOT`` variables.
|
||||
endif()
|
||||
|
||||
Reference in new issue
Block a user