From 4d8c75077eac34b4fc48510298cd1f7d215dddc5 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 13 Feb 2015 16:13:15 +0100 Subject: [PATCH] Configure: Experimental CONFIG_LTO --- default.cfg | 3 +++ ucw/perl/UCW/Configure/C.pm | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/default.cfg b/default.cfg index 9a43ab60..4788b156 100644 --- a/default.cfg +++ b/default.cfg @@ -10,6 +10,9 @@ Set("CONFIG_DEBUG"); # We want the public API Set("CONFIG_INSTALL_API"); +# Enable GCC link-time optimizations (experimental) +UnSet("CONFIG_LTO"); + # LibUCW should support files >2GB and threading Set("CONFIG_UCW_LARGE_FILES"); Set("CONFIG_UCW_THREADS" => 1); diff --git a/ucw/perl/UCW/Configure/C.pm b/ucw/perl/UCW/Configure/C.pm index 95644b45..7cd3da9e 100644 --- a/ucw/perl/UCW/Configure/C.pm +++ b/ucw/perl/UCW/Configure/C.pm @@ -170,6 +170,16 @@ if (IsSet("CONFIG_DEBUG")) { Append("LOPT" => "-s"); } +# Link-time optimization (experimental) +# This is currently very inefficient, because we do not attempt to disable +# optimizations when compiling individual modules. Therefore, we optimize +# each shared library module twice: when compiling and when linking. +# Doing it properly would require hacking makefiles. +if (IsSet("CONFIG_LTO")) { + Append("LOPT", "-flto"); + Append("COPT", "-flto"); +} + if (IsSet("CONFIG_DARWIN")) { # gcc-4.0 on Darwin doesn't set this in the gnu99 mode Append("CLANG" => "-fnested-functions"); -- 2.39.2