public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6893] configure: Add workaround for buggy binutils 2.35 [PR98811]
@ 2021-01-25 13:20 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-01-25 13:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fe5cb7f94d4e9b6fc932017d4ee74ba4f9f417b9

commit r11-6893-gfe5cb7f94d4e9b6fc932017d4ee74ba4f9f417b9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jan 25 14:20:05 2021 +0100

    configure: Add workaround for buggy binutils 2.35 [PR98811]
    
    binutils since https://sourceware.org/bugzilla/show_bug.cgi?id=25612
    changes from March last year until the
    https://sourceware.org/pipermail/binutils/2020-August/112684.html
    fix in early August emits incorrect .debug_info when assembling files
    with --gdwarf-5.  Instead of emitting proper DWARF 5 .debug_info header,
    it emits DWARF 4 .debug_info header with 5 as the dwarf version instead of
    4.  This results e.g. in libgcc.a (morestack.o) having garbage in its
    .debug_info sections and e.g. libbacktrace during pretty much all libgo
    tests fails miserably.
    
    The following patch adds a workaround for that, don't set
    HAVE_AS_GDWARF_5_DEBUG_FLAG if readelf can't read the .debug_info back.
    
    Built tested on x86_64-linux against both binutils 2.35 (buggy ones) and
    latest binutils trunk, the former with the patch now has DWARF 3
    .debug_line and DWARF 2 .debug_info in morestack.o, while the latter
    as before correct DWARF 5 .debug_line and .debug_info.
    
    2021-01-25  Jakub Jelinek  <jakub@redhat.com>
    
            PR debug/98811
            * configure.ac (HAVE_AS_GDWARF_5_DEBUG_FLAG): Only define if
            readelf -wi is able to read the emitted .debug_info back.
            * configure: Regenerated.

Diff:
---
 gcc/configure    | 6 +++++-
 gcc/configure.ac | 8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 41641c64395..9bb436ce7bd 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29075,7 +29075,11 @@ fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }
     then
-	gcc_cv_as_gdwarf_5_flag=yes
+	if test x$gcc_cv_readelf != x \
+      && $gcc_cv_readelf -wi conftest.o 2>&1 \
+	 | grep DW_TAG_compile_unit > /dev/null 2>&1; then
+     gcc_cv_as_gdwarf_5_flag=yes;
+   fi
     else
       echo "configure: failed program was" >&5
       cat conftest.s >&5
diff --git a/gcc/configure.ac b/gcc/configure.ac
index ff4d3dc078b..caa611933df 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5416,8 +5416,12 @@ if test x"$insn" != x; then
 
  gcc_GAS_CHECK_FEATURE([--gdwarf-5 option],
   gcc_cv_as_gdwarf_5_flag,
-  [elf,2,36,0], [--gdwarf-5], [$insn],,
-  [AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1,
+  [elf,2,36,0], [--gdwarf-5], [$insn],
+  [if test x$gcc_cv_readelf != x \
+      && $gcc_cv_readelf -wi conftest.o 2>&1 \
+	 | grep DW_TAG_compile_unit > /dev/null 2>&1; then
+     gcc_cv_as_gdwarf_5_flag=yes;
+   fi],[AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1,
 [Define if your assembler supports the --gdwarf-5 option.])])
 
  dwarf4_debug_info_size=0x46


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-25 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 13:20 [gcc r11-6893] configure: Add workaround for buggy binutils 2.35 [PR98811] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).