2004-09-08  H.J. Lu  <hongjiu.lu@intel.com>

	* Makeconfig (libunwind): New.
	(libgcc_eh): Add $(libunwind).
	(gnulib): Always set to -lgcc $(libgcc_eh).
	(static-gnulib): Always set to -lgcc -lgcc_eh $(libunwind).
	(libc.so-gnulib): New.
	* Makerules (LDLIBS-c.so): Use $(libc.so-gnulib) instead of
	$(static-gnulib).
	* configure.in (libc_cv_cc_with_libunwind): Set to yes if gcc
	uses -lunwind for static binaries.
This commit is contained in:
Ulrich Drepper 2004-12-15 18:54:41 +00:00
parent f8d8a2650c
commit cbdb12dec1
5 changed files with 45 additions and 67 deletions

View File

@ -1,3 +1,15 @@
2004-09-08 H.J. Lu <hongjiu.lu@intel.com>
* Makeconfig (libunwind): New.
(libgcc_eh): Add $(libunwind).
(gnulib): Always set to -lgcc $(libgcc_eh).
(static-gnulib): Always set to -lgcc -lgcc_eh $(libunwind).
(libc.so-gnulib): New.
* Makerules (LDLIBS-c.so): Use $(libc.so-gnulib) instead of
$(static-gnulib).
* configure.in (libc_cv_cc_with_libunwind): Set to yes if gcc
uses -lunwind for static binaries.
22004-06-05 Joseph S. Myers <jsm@polyomino.org.uk> 22004-06-05 Joseph S. Myers <jsm@polyomino.org.uk>
* malloc/Makefile (install-bin): Remove memusage. * malloc/Makefile (install-bin): Remove memusage.

View File

@ -508,18 +508,19 @@ link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a) link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a)
ifndef gnulib ifndef gnulib
ifneq ($(have-as-needed),yes)
libgcc_eh := -lgcc_eh
else
libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) -Wl,--no-as-needed
endif
ifneq ($(have-cc-with-libunwind),yes) ifneq ($(have-cc-with-libunwind),yes)
gnulib := -lgcc $(libgcc_eh) libunwind =
static-gnulib := -lgcc -lgcc_eh
else else
gnulib := -lgcc $(libgcc_eh) -lunwind libunwind = -lunwind
static-gnulib := -lgcc -lgcc_eh -lunwind
endif endif
ifneq ($(have-as-needed),yes)
libgcc_eh := -lgcc_eh $(libunwind)
else
libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
endif
gnulib := -lgcc $(libgcc_eh)
static-gnulib := -lgcc -lgcc_eh $(libunwind)
libc.so-gnulib := -lgcc
endif endif
ifeq ($(elf),yes) ifeq ($(elf),yes)
+preinit = $(addprefix $(csu-objpfx),crti.o) +preinit = $(addprefix $(csu-objpfx),crti.o)

View File

@ -581,8 +581,8 @@ build-shlib-objlist = $(build-module-helper-objlist) \
# Also omits crti.o and crtn.o, which we do not want # Also omits crti.o and crtn.o, which we do not want
# since we define our own `.init' section specially. # since we define our own `.init' section specially.
LDFLAGS-c.so = -nostdlib -nostartfiles LDFLAGS-c.so = -nostdlib -nostartfiles
# But we still want to link libc.so against $(static-gnulib). # But we still want to link libc.so against $(libc.so-gnulib).
LDLIBS-c.so += $(static-gnulib) LDLIBS-c.so += $(libc.so-gnulib)
# Give libc.so an entry point and make it directly runnable itself. # Give libc.so an entry point and make it directly runnable itself.
LDFLAGS-c.so += -e __libc_main LDFLAGS-c.so += -e __libc_main
# If lazy relocation is disabled add the -z now flag. # If lazy relocation is disabled add the -z now flag.

59
configure vendored
View File

@ -5399,56 +5399,17 @@ echo $ECHO_N "checking for libunwind-support in compiler... $ECHO_C" >&6
if test "${libc_cv_cc_with_libunwind+set}" = set; then if test "${libc_cv_cc_with_libunwind+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <libunwind.h>
int
main ()
{
unw_context_t uc; cat > conftest.c <<EOF
unw_cursor_t c; int main (void) { return 0; }
unw_getcontext (&uc); EOF
unw_init_local (&c, &uc) if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
; conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
return 0; libc_cv_cc_with_libunwind=yes
} else
_ACEOF libc_cv_cc_with_libunwind=no
rm -f conftest.$ac_objext conftest$ac_exeext fi
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 rm -f conftest*
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
libc_cv_cc_with_libunwind=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
libc_cv_cc_with_libunwind=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi fi
echo "$as_me:$LINENO: result: $libc_cv_cc_with_libunwind" >&5 echo "$as_me:$LINENO: result: $libc_cv_cc_with_libunwind" >&5
echo "${ECHO_T}$libc_cv_cc_with_libunwind" >&6 echo "${ECHO_T}$libc_cv_cc_with_libunwind" >&6

View File

@ -1260,13 +1260,17 @@ EOF
fi fi
AC_CACHE_CHECK(for libunwind-support in compiler, AC_CACHE_CHECK(for libunwind-support in compiler,
libc_cv_cc_with_libunwind, [dnl libc_cv_cc_with_libunwind, [
AC_TRY_LINK([#include <libunwind.h>], [ cat > conftest.c <<EOF
unw_context_t uc; int main (void) { return 0; }
unw_cursor_t c; EOF
unw_getcontext (&uc); if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
unw_init_local (&c, &uc)], conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
libc_cv_cc_with_libunwind=yes, libc_cv_cc_with_libunwind=no)]) libc_cv_cc_with_libunwind=yes
else
libc_cv_cc_with_libunwind=no
fi
rm -f conftest*])
AC_SUBST(libc_cv_cc_with_libunwind) AC_SUBST(libc_cv_cc_with_libunwind)
if test $libc_cv_cc_with_libunwind = yes; then if test $libc_cv_cc_with_libunwind = yes; then
AC_DEFINE(HAVE_CC_WITH_LIBUNWIND) AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)