Disable link-time, whole program optimization

When using LTO, the linker calls back to the compiler to figure out
where a certain symbol is defined. However, in many versions there
is apparently a bug that is triggered if a template in inlined in
both a used library and in the main program, but with different
versions of the compiler. The Boost exception class is particular
prone for this.

Thus, we disable the -lto from the development builds by default;
if anyone wants to test of the behaviour of their own compiler, they
must now explicitly turn on this flag.
This commit is contained in:
Roland Kaufmann 2013-06-13 23:19:27 +02:00
parent 5cf50de0c5
commit bfeac75fa9
4 changed files with 6 additions and 5 deletions

View File

@ -16,7 +16,8 @@ if (CMAKE_COMPILER_IS_GNUCXX)
set (_opt_flags "")
# link-time (a.k.a. global) optimizations
option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" ON)
# disabled due to widespread bugs in the linker plugin
option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" OFF)
if (WHOLE_PROG_OPTIM)
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
if (HAVE_LINK_OPTS)

4
configure vendored
View File

@ -19,7 +19,7 @@ Optional Features:
of the options shared and static may be built.
--enable-debug build a non-optimized version of the library
[default=no]
--disable-lto do not use whole program optimization [default=yes]
--enable-lto use whole program optimization [default=no]
--disable-pch do not use precompiled headers (if buggy compiler)
--disable-silent-rules print every compilation statement as executed
--enable-system-debug put .debug files in global GDB debug dir
@ -104,7 +104,7 @@ use_mpi=
silent_rules=
#debug_loc=" -DSYSTEM_DEBUG=OFF"
debug_loc=
#use_lto=" -DWHOLE_PROG_OPTIM=ON"
#use_lto=" -DWHOLE_PROG_OPTIM=OFF"
use_lto=
# default is to warn for unknown options, but this can be disabled

2
debian/rules vendored
View File

@ -19,7 +19,7 @@ override_dh_auto_build:
dh_auto_build --buildsystem=cmake
override_dh_auto_configure:
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 -DWHOLE_PROG_OPTIM=ON
override_dh_auto_install:
dh_auto_install -- install-html

View File

@ -59,7 +59,7 @@ This package contains the applications for opm-core
%setup -q
%build
cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version}
cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DWHOLE_PROG_OPTIM=ON
make
%install