This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFC: Always build libgcc_eh.a
- From: Daniel Jacobowitz <drow at false dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 Feb 2005 15:35:24 -0500
- Subject: RFC: Always build libgcc_eh.a
I'm not 100% sure this patch is a good idea, but it would be convenient for
me. All comments appreciated.
The problem I'm trying to solve is an inconsistency between two i386-linux
toolchains; one configured with --enable-shared and one configured with
--disable-shared. In the --enable-shared configuration we have:
libgcc.a - Support routines, not including EH
libgcc_eh.a - EH support routines
libgcc_s.so - Support routines, including EH
In the --disable-shared configuration we have:
libgcc.a - That's all you get, folks - all routines
When building glibc, there are a couple of places where it needs to pick up
a static copy of libgcc, including EH. Since we're building the C library,
glibc uses -nostdlib and links everything it needs explicitly. That means
it needs to know whether libgcc_eh.a is available.
The first thing I tried was to check for libgcc_eh.a during configure. That
works, but my normal process is to build a --disable-shared toolchain, then
glibc, then an --enable-shared toolchain. When I go back to my glibc
working directory, I can't rebuild glibc any more. It only pulls in
libgcc.a, and the EH routines are now missing.
This patch half solves the problem, by creating a dummy libgcc_eh.a. A
better solution IMO is to _always_ put the EH routines in libgcc_eh.a; I
took a stab at that, but since it involves always linking in -lgcc_eh even
when --disable-shared, I think it is too invasive for 4.0. And target
headers do some very strange things with LIBGCC_SPEC.
I think that making the set of libraries we provide more consistent across
configurations is valuable, even if nothing will link this library by
default. OK?
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-02-11 Daniel Jacobowitz <dan@codesourcery.com>
* gcc/mklibgcc.in: Always create libgcc_eh.a.
Index: gcc/gcc/mklibgcc.in
===================================================================
--- gcc.orig/gcc/mklibgcc.in 2005-02-11 12:50:18.762611520 -0500
+++ gcc/gcc/mklibgcc.in 2005-02-11 13:34:48.117472630 -0500
@@ -597,6 +597,17 @@ for ml in $MULTILIBS; do
echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
echo $libgcc_a: $out
done
+
+ # Create an empty libgcc_eh.a for consistency. It would be better
+ # to put the routines from LIB2ADDEH in it, but that would require
+ # even more surgery on LIBGCC_SPEC.
+ file=libgcc/${dir}/libgcc_eh.c
+ out=libgcc/${dir}/libgcc_eh${objext}
+ echo "${dir}/libgcc_eh.a: ${out}"
+ echo "${out}: stmp-dirs ${file}"
+ echo " $gcc_compile" $flags -c ${file} -o ${out}
+ echo "${file}: stmp-dirs"
+ echo " echo 'static int unused __attribute__((unused));' > ${file}"
fi
# Again, this does not handle assembly.
@@ -740,14 +751,12 @@ EOF
echo "all: $libunwind_a"
fi
- if [ "$libgcc_eh_a" ]; then
- echo ""
- echo "${dir}/libgcc_eh.a: stmp-dirs"
- echo " -rm -f ${dir}/libgcc_eh.a"
- echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a '$(objects)'
- echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
- echo "all: $libgcc_eh_a"
- fi
+ echo ""
+ echo "${dir}/libgcc_eh.a: stmp-dirs"
+ echo " -rm -f ${dir}/libgcc_eh.a"
+ echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a '$(objects)'
+ echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
+ echo "all: ${dir}/libgcc_eh.a"
# Shared libraries.
if [ "$libgcc_s_so" ]; then
@@ -815,10 +824,10 @@ for ml in $MULTILIBS; do
echo ' $(INSTALL_DATA)' ${dir}/libgcov.a ${ldir}/
echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
- if [ "$SHLIB_LINK" ]; then
- echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
- echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
+ echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
+ echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
+ if [ "$SHLIB_LINK" ]; then
if [ "$dir" = . ]; then
shlib_base_name=libgcc_s
shlibunwind_base_name=libunwind