Commit 25e08379 by Patrick Palka

Build libbackend.a as a thin archive if possible

gcc/ChangeLog:

	* configure.ac (thin_archive_support): New variable.  AC_SUBST it.
	* configure: Regenerate.
	* Makefile.in (THIN_ARCHIVE_SUPPORT): New variable.
	(USE_THIN_ARCHIVES): New variable.
	(libbackend.a): If USE_THIN_ARCHIVES then pass T to ar to build
	this archive as a thin archive.

From-SVN: r238524
parent 7c8f7eaa
2016-07-20 Patrick Palka <ppalka@gcc.gnu.org>
* configure.ac (thin_archive_support): New variable. AC_SUBST it.
* configure: Regenerate.
* Makefile.in (THIN_ARCHIVE_SUPPORT): New variable.
(USE_THIN_ARCHIVES): New variable.
(libbackend.a): If USE_THIN_ARCHIVES then pass T to ar to build
this archive as a thin archive.
2016-07-20 David Malcolm <dmalcolm@redhat.com> 2016-07-20 David Malcolm <dmalcolm@redhat.com>
* diagnostic-show-locus.c (diagnostic_show_locus): If this is the * diagnostic-show-locus.c (diagnostic_show_locus): If this is the
......
...@@ -275,6 +275,17 @@ else ...@@ -275,6 +275,17 @@ else
LLINKER = $(LINKER) LLINKER = $(LINKER)
endif endif
THIN_ARCHIVE_SUPPORT = @thin_archive_support@
USE_THIN_ARCHIVES = no
ifeq ($(THIN_ARCHIVE_SUPPORT),yes)
ifeq ($(AR_FLAGS),rc)
ifeq ($(RANLIB_FLAGS),)
USE_THIN_ARCHIVES = yes
endif
endif
endif
# ------------------------------------------- # -------------------------------------------
# Programs which operate on the build machine # Programs which operate on the build machine
# ------------------------------------------- # -------------------------------------------
...@@ -1883,8 +1894,14 @@ compilations: $(BACKEND) ...@@ -1883,8 +1894,14 @@ compilations: $(BACKEND)
# This archive is strictly for the host. # This archive is strictly for the host.
libbackend.a: $(OBJS) libbackend.a: $(OBJS)
-rm -rf libbackend.a -rm -rf libbackend.a
@# Build libbackend.a as a thin archive if possible, as doing so
@# significantly reduces build times.
ifeq ($(USE_THIN_ARCHIVES),yes)
$(AR) $(AR_FLAGS)T libbackend.a $(OBJS)
else
$(AR) $(AR_FLAGS) libbackend.a $(OBJS) $(AR) $(AR_FLAGS) libbackend.a $(OBJS)
-$(RANLIB) $(RANLIB_FLAGS) libbackend.a -$(RANLIB) $(RANLIB_FLAGS) libbackend.a
endif
libcommon-target.a: $(OBJS-libcommon-target) libcommon-target.a: $(OBJS-libcommon-target)
-rm -rf libcommon-target.a -rm -rf libcommon-target.a
......
...@@ -679,6 +679,7 @@ zlibinc ...@@ -679,6 +679,7 @@ zlibinc
zlibdir zlibdir
HOST_LIBS HOST_LIBS
enable_default_ssp enable_default_ssp
thin_archive_support
libgcc_visibility libgcc_visibility
gcc_cv_readelf gcc_cv_readelf
gcc_cv_objdump gcc_cv_objdump
...@@ -18475,7 +18476,7 @@ else ...@@ -18475,7 +18476,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 18478 "configure" #line 18479 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -18581,7 +18582,7 @@ else ...@@ -18581,7 +18582,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 18584 "configure" #line 18585 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -27846,6 +27847,21 @@ $as_echo "#define HAVE_AS_LINE_ZERO 1" >>confdefs.h ...@@ -27846,6 +27847,21 @@ $as_echo "#define HAVE_AS_LINE_ZERO 1" >>confdefs.h
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for thin archives" >&5
$as_echo_n "checking support for thin archives... " >&6; }
thin_archive_support=no
echo 'int main (void) { return 0; }' > conftest.c
if ($AR --version | sed 1q | grep "GNU ar" \
&& $CC $CFLAGS -c conftest.c \
&& $AR rcT conftest.a conftest.o \
&& $CC $CFLAGS $LDFLAGS -o conftest conftest.a) >/dev/null 2>&1; then
thin_archive_support=yes
fi
rm -f conftest.c conftest.o conftest.a conftest
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $thin_archive_support" >&5
$as_echo "$thin_archive_support" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker PT_GNU_EH_FRAME support" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker PT_GNU_EH_FRAME support" >&5
$as_echo_n "checking linker PT_GNU_EH_FRAME support... " >&6; } $as_echo_n "checking linker PT_GNU_EH_FRAME support... " >&6; }
gcc_cv_ld_eh_frame_hdr=no gcc_cv_ld_eh_frame_hdr=no
......
...@@ -4899,6 +4899,19 @@ if test "x$gcc_cv_as_line_zero" = xyes; then ...@@ -4899,6 +4899,19 @@ if test "x$gcc_cv_as_line_zero" = xyes; then
[Define if the assembler won't complain about a line such as # 0 "" 2.]) [Define if the assembler won't complain about a line such as # 0 "" 2.])
fi fi
AC_MSG_CHECKING(support for thin archives)
thin_archive_support=no
echo 'int main (void) { return 0; }' > conftest.c
if ($AR --version | sed 1q | grep "GNU ar" \
&& $CC $CFLAGS -c conftest.c \
&& $AR rcT conftest.a conftest.o \
&& $CC $CFLAGS $LDFLAGS -o conftest conftest.a) >/dev/null 2>&1; then
thin_archive_support=yes
fi
rm -f conftest.c conftest.o conftest.a conftest
AC_MSG_RESULT($thin_archive_support)
AC_SUBST(thin_archive_support)
AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support) AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
gcc_cv_ld_eh_frame_hdr=no gcc_cv_ld_eh_frame_hdr=no
if test $in_tree_ld = yes ; then if test $in_tree_ld = yes ; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment