diff --git a/Makeconfig b/Makeconfig index 78852dc234..b2c81e1faa 100644 --- a/Makeconfig +++ b/Makeconfig @@ -716,6 +716,12 @@ CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 libtype.oS = lib%_nonshared.a endif +# The assembler can generate debug information too. +ifndef ASFLAGS +ifeq ($(have-cpp-asm-debuginfo),yes) +ASFLAGS := $(filter -g%,$(CFLAGS)) +endif +endif +gnu-stabs = $(shell echo>&2 '*** BARF ON ME') diff --git a/Makerules b/Makerules index c4a28ae8bd..1b57e29553 100644 --- a/Makerules +++ b/Makerules @@ -396,8 +396,10 @@ endif # GCC can grok options after the file name, and it looks nicer that way. compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS) -compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) $(ASFLAGS-$(suffix $@)) -COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) $(ASFLAGS-$(suffix $@)) +compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) \ + $(ASFLAGS) $(ASFLAGS-$(suffix $@)) +COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \ + $(ASFLAGS) $(ASFLAGS-$(suffix $@)) COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS) # If we want to generate MD5 checksums for the sources do this now. diff --git a/config.h.in b/config.h.in index d00d33483b..29b809e8cf 100644 --- a/config.h.in +++ b/config.h.in @@ -58,6 +58,9 @@ /* Define a symbol_name as a global .symbol_name for ld. */ #undef HAVE_ASM_GLOBAL_DOT_NAME +/* Define if the assembler generates debugging information directly. */ +#undef HAVE_CPP_ASM_DEBUGINFO + /* Define if _Unwind_Find_FDE should be exported from glibc. */ #undef EXPORT_UNWIND_FIND_FDE diff --git a/config.make.in b/config.make.in index ed0ad416a2..da6bb5cf4d 100644 --- a/config.make.in +++ b/config.make.in @@ -50,6 +50,7 @@ with-cvs = @with_cvs@ old-glibc-headers = @old_glibc_headers@ unwind-find-fde = @libc_cv_gcc_unwind_find_fde@ have-initfini-array = @libc_cv_initfinit_array@ +have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@ static-libgcc = @libc_cv_gcc_static_libgcc@ diff --git a/configure b/configure index 0dfc3c6010..2fd3e54312 100755 --- a/configure +++ b/configure @@ -312,7 +312,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs oldest_abi subdirs force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S PWD_P CC MAKE MSGFMT MAKEINFO SED AUTOCONF CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD CCVERSION SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO OLD_DEBIAN_INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_Bgroup libc_cv_z_combreloc libc_cv_have_initfini no_whole_archive exceptions LIBGD EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs oldest_abi subdirs force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S PWD_P CC MAKE MSGFMT MAKEINFO SED AUTOCONF CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD CCVERSION SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO OLD_DEBIAN_INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_Bgroup libc_cv_z_combreloc libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5272,6 +5272,57 @@ _ACEOF ;; esac +echo "$as_me:$LINENO: checking if -g produces usable source locations for assembler-with-cpp" >&5 +echo $ECHO_N "checking if -g produces usable source locations for assembler-with-cpp... $ECHO_C" >&6 +if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.S <&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + ac_pattern='conftest\.S' + { ac_try='readelf --debug-dump=line conftest.o | + grep $ac_pattern 1>&5' + { (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_cpp_asm_debuginfo=yes +else + libc_cv_cpp_asm_debuginfo=no +fi +rm -f conftest* +fi +echo "$as_me:$LINENO: result: $libc_cv_cpp_asm_debuginfo" >&5 +echo "${ECHO_T}$libc_cv_cpp_asm_debuginfo" >&6 +if test $libc_cv_cpp_asm_debuginfo = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_CPP_ASM_DEBUGINFO 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking for ld --no-whole-archive" >&5 echo $ECHO_N "checking for ld --no-whole-archive... $ECHO_C" >&6 if test "${libc_cv_ld_no_whole_archive+set}" = set; then @@ -5393,7 +5444,7 @@ if test "${libc_cv_gcc_dwarf2_unwind_info+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.c <&6 else cat > conftest.c <&6 else cat > conftest.c < conftest.S <&AS_MESSAGE_LOG_FD]) && + ac_pattern='conftest\.S' + AC_TRY_COMMAND([readelf --debug-dump=line conftest.o | + grep $ac_pattern 1>&AS_MESSAGE_LOG_FD]); then + libc_cv_cpp_asm_debuginfo=yes +else + libc_cv_cpp_asm_debuginfo=no +fi +rm -f conftest*])AC_SUBST(libc_cv_cpp_asm_debuginfo) +if test $libc_cv_cpp_asm_debuginfo = yes; then + AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO) +fi + AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl cat > conftest.c <<\EOF _start () {}