mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Enabled LTO for LLVM and making use of jobserver for LTO in GCC
This commit is contained in:
parent
3f3770f117
commit
0f9d8c9ec0
@ -158,7 +158,7 @@ $(objdir)/.dir-stamp: Makefile
|
|||||||
|
|
||||||
$(client) $(daemon):
|
$(client) $(daemon):
|
||||||
$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
+$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
$(objdir)/sysdep/paths.h: Makefile
|
$(objdir)/sysdep/paths.h: Makefile
|
||||||
$(E)echo GEN $@
|
$(E)echo GEN $@
|
||||||
@ -173,7 +173,7 @@ tests_targets_ok = $(addsuffix .ok,$(tests_targets))
|
|||||||
|
|
||||||
$(tests_targets): %: %.o $(tests_objs) | prepare
|
$(tests_targets): %: %.o $(tests_objs) | prepare
|
||||||
$(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
|
$(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
|
||||||
$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
+$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
# Hack to avoid problems with tests linking everything
|
# Hack to avoid problems with tests linking everything
|
||||||
$(tests_targets): LIBS += $(DAEMON_LIBS)
|
$(tests_targets): LIBS += $(DAEMON_LIBS)
|
||||||
|
6
aclocal.m4
vendored
6
aclocal.m4
vendored
@ -11,7 +11,7 @@ AC_DEFUN([BIRD_COMPILER_VENDOR],
|
|||||||
AC_COMPILE_IFELSE([
|
AC_COMPILE_IFELSE([
|
||||||
AC_LANG_PROGRAM([ int x = __clang__; ], [])
|
AC_LANG_PROGRAM([ int x = __clang__; ], [])
|
||||||
],
|
],
|
||||||
[bird_cv_compiler_vendor=clang],
|
[bird_cv_compiler_vendor=llvm],
|
||||||
AC_COMPILE_IFELSE([
|
AC_COMPILE_IFELSE([
|
||||||
AC_LANG_PROGRAM([ int x = __GNUC__; ], [])
|
AC_LANG_PROGRAM([ int x = __GNUC__; ], [])
|
||||||
],
|
],
|
||||||
@ -234,8 +234,8 @@ AC_DEFUN([BIRD_CHECK_LTO],
|
|||||||
[
|
[
|
||||||
bird_tmp_cflags="$CFLAGS"
|
bird_tmp_cflags="$CFLAGS"
|
||||||
bird_tmp_ldflags="$LDFLAGS"
|
bird_tmp_ldflags="$LDFLAGS"
|
||||||
CFLAGS="-flto"
|
CFLAGS="$1"
|
||||||
LDFLAGS="-flto=4"
|
LDFLAGS="$2"
|
||||||
|
|
||||||
AC_CACHE_CHECK(
|
AC_CACHE_CHECK(
|
||||||
[whether link time optimizer is available],
|
[whether link time optimizer is available],
|
||||||
|
14
configure.ac
14
configure.ac
@ -124,6 +124,8 @@ if test -z "$GCC" ; then
|
|||||||
AC_MSG_ERROR([This program requires the GNU C Compiler.])
|
AC_MSG_ERROR([This program requires the GNU C Compiler.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BIRD_COMPILER_VENDOR
|
||||||
|
|
||||||
BIRD_CHECK_THREAD_LOCAL
|
BIRD_CHECK_THREAD_LOCAL
|
||||||
if test "$bird_cv_thread_local" = no ; then
|
if test "$bird_cv_thread_local" = no ; then
|
||||||
AC_MSG_ERROR([This program requires thread local storage.])
|
AC_MSG_ERROR([This program requires thread local storage.])
|
||||||
@ -149,12 +151,18 @@ if test "$bird_cflags_default" = yes ; then
|
|||||||
BIRD_CHECK_GCC_OPTION([bird_cv_c_option_watomic_implicit_seq_cst], [-Watomic-implicit-seq-cst], [-Wall -Wextra])
|
BIRD_CHECK_GCC_OPTION([bird_cv_c_option_watomic_implicit_seq_cst], [-Watomic-implicit-seq-cst], [-Wall -Wextra])
|
||||||
|
|
||||||
if test "$enable_debug" = no; then
|
if test "$enable_debug" = no; then
|
||||||
BIRD_CHECK_LTO
|
LTO_CFLAGS=-flto
|
||||||
|
AS_CASE(${bird_cv_compiler_vendor},
|
||||||
|
gnu,LTO_LDFLAGS="-flto=jobserver",
|
||||||
|
llvm,LTO_LDFLAGS="-flto",
|
||||||
|
unknown,LTO_LDFLAGS="-flto",
|
||||||
|
AC_MSG_ERROR([Compiler vendor check failed for LTO: got ${bird_cv_compiler_vendor}]))
|
||||||
|
BIRD_CHECK_LTO(${LTO_CFLAGS}, ${LTO_LDFLAGS})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$bird_cv_c_lto" = yes; then
|
if test "$bird_cv_c_lto" = yes; then
|
||||||
CFLAGS="$CFLAGS -flto"
|
CFLAGS="$CFLAGS $LTO_CFLAGS"
|
||||||
LDFLAGS="$LDFLAGS -flto=4 -g"
|
LDFLAGS="$LDFLAGS $LTO_LDFLAGS -g"
|
||||||
else
|
else
|
||||||
LDFLAGS="$LDFLAGS -g"
|
LDFLAGS="$LDFLAGS -g"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user