Hi!

The following patch adds a readelf fallback if objdump nor otool don't
exist.  All of GNU binutils readelf, eu-readelf and llvm-readelf can
handle it with those options.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2025-08-27  Jakub Jelinek  <ja...@redhat.com>

        PR debug/119367
        * configure.ac (gcc_cv_as_leb128): Add fallback using readelf.
        Grammar fix in comment.
        * configure: Regenerate.

--- gcc/configure.ac.jj 2025-08-27 13:05:35.153493266 +0200
+++ gcc/configure.ac    2025-08-27 13:32:51.164032649 +0200
@@ -3307,8 +3307,8 @@ case $target in
 esac
 
 # Check if we have .[us]leb128, and support symbol arithmetic with it.
-# Older versions of GAS and some non-GNU assemblers, have a bugs handling
-# these directives, even when they appear to accept them.
+# Older versions of GAS and some non-GNU assemblers have bugs in handling
+# of these directives, even when they appear to accept them.
 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
 [$check_leb128_asflags],
 [      .data
@@ -3330,6 +3330,11 @@ elif test "x$gcc_cv_otool" != x; then
      | grep '04 80 0a 8e 78 80 80 80 80 80 80 80 80 80 01' >/dev/null; then
     gcc_cv_as_leb128=yes
   fi
+elif test "x$gcc_cv_readelf" != x; then
+  if $gcc_cv_readelf -x .data conftest.o 2>/dev/null \
+     | grep '04800a8e 78808080 80808080 808001' >/dev/null; then
+    gcc_cv_as_leb128=yes
+  fi
 else
   # play safe, assume the assembler is broken.
   :
--- gcc/configure.jj    2025-08-27 13:06:16.692947978 +0200
+++ gcc/configure       2025-08-27 13:33:52.538227681 +0200
@@ -26500,8 +26500,8 @@ fi
 esac
 
 # Check if we have .[us]leb128, and support symbol arithmetic with it.
-# Older versions of GAS and some non-GNU assemblers, have a bugs handling
-# these directives, even when they appear to accept them.
+# Older versions of GAS and some non-GNU assemblers have bugs in handling
+# of these directives, even when they appear to accept them.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .sleb128 and 
.uleb128" >&5
 $as_echo_n "checking assembler for .sleb128 and .uleb128... " >&6; }
 if ${gcc_cv_as_leb128+:} false; then :
@@ -26535,6 +26535,11 @@ elif test "x$gcc_cv_otool" != x; then
      | grep '04 80 0a 8e 78 80 80 80 80 80 80 80 80 80 01' >/dev/null; then
     gcc_cv_as_leb128=yes
   fi
+elif test "x$gcc_cv_readelf" != x; then
+  if $gcc_cv_readelf -x .data conftest.o 2>/dev/null \
+     | grep '04800a8e 78808080 80808080 808001' >/dev/null; then
+    gcc_cv_as_leb128=yes
+  fi
 else
   # play safe, assume the assembler is broken.
   :

        Jakub

Reply via email to