From 0b118d5b4c41970045ea16628606e519abc115bd Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 28 Feb 2018 08:59:15 +0000 Subject: [PATCH] PR debug/83917 * configure.ac (AS_HIDDEN_DIRECTIVE): AC_DEFINE_UNQUOTED this to $asm_hidden_op if visibility ("hidden") attribute works. (HAVE_AS_CFI_SECTIONS): New AC_DEFINE. * config/i386/i386-asm.h: Don't include auto-host.h. (PACKAGE_VERSION, PACKAGE_NAME, PACKAGE_STRING, PACKAGE_TARNAME, PACKAGE_URL): Don't undefine. (USE_GAS_CFI_DIRECTIVES): Don't use nor define this macro, instead guard cfi_startproc only on ifdef __GCC_HAVE_DWARF2_CFI_ASM. (FN_HIDDEN): Change guard from #ifdef HAVE_GAS_HIDDEN to #ifdef AS_HIDDEN_DIRECTIVE, use AS_HIDDEN_DIRECTIVE macro in the definition instead of hardcoded .hidden. * config/i386/cygwin.S: Include i386-asm.h first before .cfi_sections directive. Use #ifdef HAVE_AS_CFI_SECTIONS rather than #ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE to guard .cfi_sections. (USE_GAS_CFI_DIRECTIVES): Don't define. * configure: Regenerated. * config.in: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258057 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 21 +++++++++++++++++++++ libgcc/config.in | 7 +++++++ libgcc/config/i386/cygwin.S | 8 +++----- libgcc/config/i386/i386-asm.h | 21 ++++----------------- libgcc/configure | 36 ++++++++++++++++++++++++++++++++++++ libgcc/configure.ac | 18 ++++++++++++++++++ 6 files changed, 89 insertions(+), 22 deletions(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index d29f2f495e0..e93967799ea 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,24 @@ +2018-02-28 Jakub Jelinek + + PR debug/83917 + * configure.ac (AS_HIDDEN_DIRECTIVE): AC_DEFINE_UNQUOTED this to + $asm_hidden_op if visibility ("hidden") attribute works. + (HAVE_AS_CFI_SECTIONS): New AC_DEFINE. + * config/i386/i386-asm.h: Don't include auto-host.h. + (PACKAGE_VERSION, PACKAGE_NAME, PACKAGE_STRING, PACKAGE_TARNAME, + PACKAGE_URL): Don't undefine. + (USE_GAS_CFI_DIRECTIVES): Don't use nor define this macro, instead + guard cfi_startproc only on ifdef __GCC_HAVE_DWARF2_CFI_ASM. + (FN_HIDDEN): Change guard from #ifdef HAVE_GAS_HIDDEN to + #ifdef AS_HIDDEN_DIRECTIVE, use AS_HIDDEN_DIRECTIVE macro in the + definition instead of hardcoded .hidden. + * config/i386/cygwin.S: Include i386-asm.h first before .cfi_sections + directive. Use #ifdef HAVE_AS_CFI_SECTIONS rather than + #ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE to guard .cfi_sections. + (USE_GAS_CFI_DIRECTIVES): Don't define. + * configure: Regenerated. + * config.in: Likewise. + 2018-02-26 Jakub Jelinek PR debug/83917 diff --git a/libgcc/config.in b/libgcc/config.in index f9fb253874f..d634af9d949 100644 --- a/libgcc/config.in +++ b/libgcc/config.in @@ -1,8 +1,15 @@ /* config.in. Generated from configure.ac by autoheader. */ +/* Define to the .hidden-like directive if it exists. */ +#undef AS_HIDDEN_DIRECTIVE + /* Define to 1 if the assembler supports AVX. */ #undef HAVE_AS_AVX +/* Define to 1 if the assembler supports .cfi_sections .debug_frame directive. + */ +#undef HAVE_AS_CFI_SECTIONS + /* Define to 1 if the target assembler supports thread-local storage. */ #undef HAVE_CC_TLS diff --git a/libgcc/config/i386/cygwin.S b/libgcc/config/i386/cygwin.S index f856be3e88a..ece17f82a68 100644 --- a/libgcc/config/i386/cygwin.S +++ b/libgcc/config/i386/cygwin.S @@ -23,13 +23,11 @@ * . */ -#ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE -# define USE_GAS_CFI_DIRECTIVES 1 +#include "i386-asm.h" + +#ifdef HAVE_AS_CFI_SECTIONS .cfi_sections .debug_frame -#else -# define USE_GAS_CFI_DIRECTIVES 0 #endif -#include "i386-asm.h" #ifdef L_chkstk /* Function prologue calls __chkstk to probe the stack when allocating more diff --git a/libgcc/config/i386/i386-asm.h b/libgcc/config/i386/i386-asm.h index dbf99564b0c..b5b7fb44fa5 100644 --- a/libgcc/config/i386/i386-asm.h +++ b/libgcc/config/i386/i386-asm.h @@ -27,21 +27,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define I386_ASM_H #include "auto-target.h" -#undef PACKAGE_VERSION -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_URL -#include "auto-host.h" - -#ifndef USE_GAS_CFI_DIRECTIVES -# ifdef __GCC_HAVE_DWARF2_CFI_ASM -# define USE_GAS_CFI_DIRECTIVES 1 -# else -# define USE_GAS_CFI_DIRECTIVES 0 -# endif -#endif -#if USE_GAS_CFI_DIRECTIVES + +#ifdef __GCC_HAVE_DWARF2_CFI_ASM # define cfi_startproc() .cfi_startproc # define cfi_endproc() .cfi_endproc # define cfi_adjust_cfa_offset(X) .cfi_adjust_cfa_offset X @@ -76,8 +63,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifdef __ELF__ # define FN_TYPE(fn) .type fn,@function # define FN_SIZE(fn) .size fn,.-fn -# ifdef HAVE_GAS_HIDDEN -# define FN_HIDDEN(fn) .hidden fn +# ifdef AS_HIDDEN_DIRECTIVE +# define FN_HIDDEN(fn) AS_HIDDEN_DIRECTIVE fn # endif #else # define FN_TYPE(fn) diff --git a/libgcc/configure b/libgcc/configure index 3241f19ab67..7399c862bb0 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -5214,11 +5214,47 @@ $as_echo "$libgcc_cv_hidden_visibility_attribute" >&6; } if test $libgcc_cv_hidden_visibility_attribute = yes; then vis_hide='-fvisibility=hidden -DHIDE_EXPORTS' + +cat >>confdefs.h <<_ACEOF +#define AS_HIDDEN_DIRECTIVE $asm_hidden_op +_ACEOF + else vis_hide= fi +# Check for .cfi_sections .debug_frame support. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for .cfi_sections .debug_frame" >&5 +$as_echo_n "checking for .cfi_sections .debug_frame... " >&6; } +if test "${libgcc_cv_cfi_sections_directive+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + echo 'int foo (int, char *);' > conftest.c + echo 'int bar (int x) { char *y = __builtin_alloca (x); return foo (x + 1, y) + 1; }' >> conftest.c + libgcc_cv_cfi_sections_directive=no + if { ac_try='${CC-cc} -Werror -g -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -S conftest.c -o conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + if grep "\\.cfi_sections.*\\.debug_frame" conftest.s >/dev/null; then + libgcc_cv_cfi_sections_directive=yes + fi + fi + rm -f conftest.* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_cfi_sections_directive" >&5 +$as_echo "$libgcc_cv_cfi_sections_directive" >&6; } +if test $libgcc_cv_cfi_sections_directive = yes; then + +$as_echo "#define HAVE_AS_CFI_SECTIONS 1" >>confdefs.h + +fi + # See if we have thread-local storage. We can only test assembler # since link-time and run-time tests require the newly built # gcc, which can't be used to build executable due to that libgcc diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 6e76a68bc0c..b59aa746afc 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -486,11 +486,29 @@ AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], if test $libgcc_cv_hidden_visibility_attribute = yes; then vis_hide='-fvisibility=hidden -DHIDE_EXPORTS' + AC_DEFINE_UNQUOTED(AS_HIDDEN_DIRECTIVE, $asm_hidden_op, [Define to the .hidden-like directive if it exists.]) else vis_hide= fi AC_SUBST(vis_hide) +# Check for .cfi_sections .debug_frame support. +AC_CACHE_CHECK([for .cfi_sections .debug_frame], + libgcc_cv_cfi_sections_directive, [ + echo 'int foo (int, char *);' > conftest.c + echo 'int bar (int x) { char *y = __builtin_alloca (x); return foo (x + 1, y) + 1; }' >> conftest.c + libgcc_cv_cfi_sections_directive=no + if AC_TRY_COMMAND(${CC-cc} -Werror -g -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then + if grep "\\.cfi_sections.*\\.debug_frame" conftest.s >/dev/null; then + libgcc_cv_cfi_sections_directive=yes + fi + fi + rm -f conftest.* + ]) +if test $libgcc_cv_cfi_sections_directive = yes; then + AC_DEFINE(HAVE_AS_CFI_SECTIONS, 1, [Define to 1 if the assembler supports .cfi_sections .debug_frame directive.]) +fi + # See if we have thread-local storage. We can only test assembler # since link-time and run-time tests require the newly built # gcc, which can't be used to build executable due to that libgcc -- 2.11.4.GIT