2004-09-08 H.J. Lu * 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. * configure: Regenerated. --- libc/Makeconfig.unwind 2004-08-11 14:23:00.000000000 -0700 +++ libc/Makeconfig 2004-09-08 10:07:59.512198328 -0700 @@ -521,18 +521,19 @@ link-libc-bounded = $(common-objpfx)libc link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a) ifndef gnulib -ifneq ($(have-as-needed),yes) - libgcc_eh := -lgcc_eh +ifneq ($(have-cc-with-libunwind),yes) + libunwind = else - libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) -Wl,--no-as-needed + libunwind = -lunwind endif -ifneq ($(have-cc-with-libunwind),yes) - gnulib := -lgcc $(libgcc_eh) - static-gnulib := -lgcc -lgcc_eh +ifneq ($(have-as-needed),yes) + libgcc_eh := -lgcc_eh $(libunwind) else - gnulib := -lgcc $(libgcc_eh) -lunwind - static-gnulib := -lgcc -lgcc_eh -lunwind + 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 ifeq ($(elf),yes) +preinit = $(addprefix $(csu-objpfx),crti.o) --- libc/Makerules.unwind 2004-09-01 15:44:48.000000000 -0700 +++ libc/Makerules 2004-09-08 09:12:53.000000000 -0700 @@ -581,8 +581,8 @@ build-shlib-objlist = $(build-module-hel # Also omits crti.o and crtn.o, which we do not want # since we define our own `.init' section specially. LDFLAGS-c.so = -nostdlib -nostartfiles -# But we still want to link libc.so against $(static-gnulib). -LDLIBS-c.so += $(static-gnulib) +# But we still want to link libc.so against $(libc.so-gnulib). +LDLIBS-c.so += $(libc.so-gnulib) # Give libc.so an entry point and make it directly runnable itself. LDFLAGS-c.so += -e __libc_main # If lazy relocation is disabled add the -z now flag. --- libc/configure.in.unwind 2004-09-08 09:12:53.000000000 -0700 +++ libc/configure.in 2004-09-08 09:12:53.000000000 -0700 @@ -1309,13 +1309,17 @@ EOF fi AC_CACHE_CHECK(for libunwind-support in compiler, - libc_cv_cc_with_libunwind, [dnl - AC_TRY_LINK([#include ], [ - unw_context_t uc; - unw_cursor_t c; - unw_getcontext (&uc); - unw_init_local (&c, &uc)], - libc_cv_cc_with_libunwind=yes, libc_cv_cc_with_libunwind=no)]) + libc_cv_cc_with_libunwind, [ + cat > conftest.c <&1 >/dev/null | grep -q " -lunwind "; then + libc_cv_cc_with_libunwind=yes + else + libc_cv_cc_with_libunwind=no + fi + rm -f conftest*]) AC_SUBST(libc_cv_cc_with_libunwind) if test $libc_cv_cc_with_libunwind = yes; then AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)