From: Jakub Jelinek Date: Thu, 28 Aug 2025 08:10:28 +0000 (+0200) Subject: configure: Add readelf fallback for HAVE_AS_ULEB128 test [PR119367] X-Git-Tag: basepoints/gcc-17~5378 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=866697bac2cd3e05875d6a0dc3f64590143fd894;p=thirdparty%2Fgcc.git configure: Add readelf fallback for HAVE_AS_ULEB128 test [PR119367] 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. 2025-08-28 Jakub Jelinek PR debug/119367 * configure.ac (gcc_cv_as_leb128): Add fallback using readelf. Grammar fix in comment. * configure: Regenerate. --- diff --git a/gcc/configure b/gcc/configure index 4a751d969ba..013865a2bb6 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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. : diff --git a/gcc/configure.ac b/gcc/configure.ac index 4532c5c22fe..2532523b002 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -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. :