Skip to content

Commit 2ac2821

Browse files
committed
Merge bitcoin/bitcoin#29185: build: remove --enable-lto
2d1b1c7 build: remove --enable-lto (fanquake) Pull request description: This has outlived its usefulness, doesn't gel well with newer compilers & `-flto` related options, i.e thin vs full, or `=auto`, and having `-flto` as the only option means that sometimes this just needs to be worked around, i.e in oss-fuzz: https://github.com/google/oss-fuzz/blob/master/projects/bitcoin-core/build.sh. While it was convenient when `-flto` was newer, support for `-flto` is now in all compilers we use, and there's also no-longer any real need for us to treat `-flto` different to any other optimization option. Remove it, to remove build complexity, and so there's no need to port a similar option to CMake. Note that the LTO option remains in depends, because we still a way to build packages that have LTO specific patches/options. ACKs for top commit: TheCharlatan: ACK 2d1b1c7 hebasto: ACK 2d1b1c7. Tree-SHA512: 91812de7da35346f51850714a188fcffbac478bc8b348bf756c2555fcbde86ba622ac2fb77d294dea0378c741d3656f06121ef3a795aeed63fd170fc31bfa5af
2 parents 05c4c5a + 2d1b1c7 commit 2ac2821

File tree

11 files changed

+5
-57
lines changed

11 files changed

+5
-57
lines changed

configure.ac

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,6 @@ AC_ARG_ENABLE([external-signer],
321321
[use_external_signer=$enableval],
322322
[use_external_signer=auto])
323323

324-
AC_ARG_ENABLE([lto],
325-
[AS_HELP_STRING([--enable-lto],[build using LTO (default is no)])],
326-
[enable_lto=$enableval],
327-
[enable_lto=no])
328-
329324
AC_LANG_PUSH([C++])
330325

331326
dnl Check for a flag to turn compiler warnings into errors. This is helpful for checks which may
@@ -377,11 +372,6 @@ if test "$enable_debug" = "yes"; then
377372
AX_CHECK_COMPILE_FLAG([-ftrapv], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"], [], [$CXXFLAG_WERROR])
378373
fi
379374

380-
if test "$enable_lto" = "yes"; then
381-
AX_CHECK_COMPILE_FLAG([-flto], [LTO_CXXFLAGS="$LTO_CXXFLAGS -flto"], [AC_MSG_ERROR([compile failed with -flto])], [$CXXFLAG_WERROR])
382-
AX_CHECK_LINK_FLAG([-flto], [LTO_LDFLAGS="$LTO_LDFLAGS -flto"], [AC_MSG_ERROR([link failed with -flto])], [$CXXFLAG_WERROR])
383-
fi
384-
385375
if test "$use_sanitizers" != ""; then
386376
dnl First check if the compiler accepts flags. If an incompatible pair like
387377
dnl -fsanitize=address,thread is used here, this check will fail. This will also
@@ -1891,8 +1881,6 @@ AC_SUBST(GPROF_LDFLAGS)
18911881
AC_SUBST(HARDENED_CXXFLAGS)
18921882
AC_SUBST(HARDENED_CPPFLAGS)
18931883
AC_SUBST(HARDENED_LDFLAGS)
1894-
AC_SUBST(LTO_CXXFLAGS)
1895-
AC_SUBST(LTO_LDFLAGS)
18961884
AC_SUBST(PIC_FLAGS)
18971885
AC_SUBST(PIE_FLAGS)
18981886
AC_SUBST(SANITIZER_CXXFLAGS)
@@ -2000,7 +1988,6 @@ echo " sanitizers = $use_sanitizers"
20001988
echo " debug enabled = $enable_debug"
20011989
echo " gprof enabled = $enable_gprof"
20021990
echo " werror = $enable_werror"
2003-
echo " LTO = $enable_lto"
20041991
echo
20051992
echo " target os = $host_os"
20061993
echo " build os = $build_os"
@@ -2009,8 +1996,8 @@ echo " CC = $CC"
20091996
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
20101997
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS"
20111998
echo " CXX = $CXX"
2012-
echo " CXXFLAGS = $LTO_CXXFLAGS $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
2013-
echo " LDFLAGS = $LTO_LDFLAGS $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $CORE_LDFLAGS $LDFLAGS"
1999+
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
2000+
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $CORE_LDFLAGS $LDFLAGS"
20142001
echo " AR = $AR"
20152002
echo " ARFLAGS = $ARFLAGS"
20162003
echo

depends/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ The following can be set when running make: `make FOO=bar`
120120
- `LOG`: Use file-based logging for individual packages. During a package build its log file
121121
resides in the `depends` directory, and the log file is printed out automatically in case
122122
of build error. After successful build log files are moved along with package archives
123-
- `LTO`: Use LTO when building packages.
123+
- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.
124124
- `NO_HARDEN=1`: Don't use hardening options when building packages
125125

126126
If some packages are not built, for example `make NO_WALLET=1`, the appropriate

depends/config.site.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ if test "@host_os@" = darwin; then
7878
BREW=no
7979
fi
8080

81-
if test -z "$enable_lto" && test -n "@lto@"; then
82-
enable_lto=yes
83-
fi
84-
8581
if test -z "$enable_hardening" && test -n "@no_harden@"; then
8682
enable_hardening=no
8783
fi

depends/hosts/android.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ endif
99
android_CFLAGS=-std=$(C_STANDARD)
1010
android_CXXFLAGS=-std=$(CXX_STANDARD)
1111

12-
ifneq ($(LTO),)
13-
android_CFLAGS += -flto
14-
android_LDFLAGS += -flto
15-
endif
16-
1712
android_AR=$(ANDROID_TOOLCHAIN_BIN)/llvm-ar
1813
android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/llvm-ranlib
1914

depends/hosts/darwin.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ darwin_CFLAGS=-pipe -std=$(C_STANDARD)
9797
darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
9898
darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION)
9999

100-
ifneq ($(LTO),)
101-
darwin_CFLAGS += -flto
102-
darwin_CXXFLAGS += -flto
103-
darwin_LDFLAGS += -flto
104-
endif
105-
106100
darwin_release_CFLAGS=-O2
107101
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
108102

depends/hosts/freebsd.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
freebsd_CFLAGS=-pipe -std=$(C_STANDARD)
22
freebsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
33

4-
ifneq ($(LTO),)
5-
freebsd_CFLAGS += -flto
6-
freebsd_CXXFLAGS += -flto
7-
freebsd_LDFLAGS += -flto
8-
endif
9-
104
freebsd_release_CFLAGS=-O2
115
freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)
126

depends/hosts/linux.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ linux_CFLAGS=-pipe -std=$(C_STANDARD)
22
linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
33

44
ifneq ($(LTO),)
5-
linux_CFLAGS += -flto
6-
linux_CXXFLAGS += -flto
7-
linux_LDFLAGS += -flto
8-
95
linux_AR = $(host_toolchain)gcc-ar
106
linux_NM = $(host_toolchain)gcc-nm
117
linux_RANLIB = $(host_toolchain)gcc-ranlib

depends/hosts/mingw32.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ mingw32_CFLAGS=-pipe -std=$(C_STANDARD)
66
mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
77

88
ifneq ($(LTO),)
9-
mingw32_CFLAGS += -flto
10-
mingw32_CXXFLAGS += -flto
11-
mingw32_LDFLAGS += -flto
12-
139
mingw32_AR = $(host_toolchain)gcc-ar
1410
mingw32_NM = $(host_toolchain)gcc-nm
1511
mingw32_RANLIB = $(host_toolchain)gcc-ranlib

depends/hosts/netbsd.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ netbsd_CFLAGS=-pipe -std=$(C_STANDARD)
22
netbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
33

44
ifneq ($(LTO),)
5-
netbsd_CFLAGS += -flto
6-
netbsd_CXXFLAGS += -flto
7-
netbsd_LDFLAGS += -flto
8-
95
netbsd_AR = $(host_toolchain)gcc-ar
106
netbsd_NM = $(host_toolchain)gcc-nm
117
netbsd_RANLIB = $(host_toolchain)gcc-ranlib

depends/hosts/openbsd.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
openbsd_CFLAGS=-pipe -std=$(C_STANDARD)
22
openbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
33

4-
ifneq ($(LTO),)
5-
openbsd_CFLAGS += -flto
6-
openbsd_CXXFLAGS += -flto
7-
openbsd_LDFLAGS += -flto
8-
endif
9-
104
openbsd_release_CFLAGS=-O2
115
openbsd_release_CXXFLAGS=$(openbsd_release_CFLAGS)
126

0 commit comments

Comments
 (0)