[adtools] Re: [Patch] Assembler .[us]leb128 test in gcc/gcc/configure

  • From: Trevor Scroggins <trevor.scroggins@xxxxxxxxx>
  • To: adtools@xxxxxxxxxxxxx
  • Date: Wed, 14 Jul 2010 08:40:50 -0700

Hi,

On Wed, Jul 14, 2010 at 1:58 AM, Sebastian Bauer
<mail@xxxxxxxxxxxxxxxxxxx> wrote:
> Trevor Scroggins <trevor.scroggins@xxxxxxxxx> schrieb:
>> This is just a small patch to fix the assembler .[us]leb128 test in
>> gcc/gcc/configure[.ac] for our version of Binutils.
>
> Could you explain the impact of this patch? I.e., what does it fix?

Per configure, "Check if we have .[us]leb128, and support symbol
arithmetic with it." GAS 2.11 reports that it support this, but
according to the configure script, it does not. The script
double-checks the GAS version after the initial test succeeds. The
current test assumes the target `as --version` prints `GNU assembler
[version]'. Our version of as prints `GNU assembler (GNU Binutils)
2.18', and subsequent sed and test expressions are invalid.

I.e. `if test $as_major -eq 2 && test $as_minor -lt 11' returns an
invalid number of arguments error. Because of the way the test is
written,

    if test $as_major -eq 2 && test $as_minor -lt 11
    then :
    else gcc_cv_as_leb128=yes
    fi

a syntax error in either test statement will result in the else branch
being taken, and the overall test will succeed. Luckily, this is
correct for us (and many others).

The mainline GCC trunk uses this,

  as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
  if echo "$as_ver" | grep GNU > /dev/null; then
    as_vers=`echo $as_ver | sed -n \
        -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
    as_major=`expr "$as_vers" : '\([0-9]*\)'`
    as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'`
    if test $as_major -eq 2 && test $as_minor -lt 11
    then :
    else gcc_cv_as_leb128=yes
    fi
  fi

which probably covers more cases. It was first fixed with
http://gcc.gnu.org/viewcvs?view=revision&revision=127745, but it
appears to have been modified again without comment.

Your 4.4.3 branch already has the fix.

Trev
-- 
______________________________________________________________________________
Amiga Development tools ML - //www.freelists.org/list/adtools
Homepage...................: http://www.sourceforge.net/projects/adtools
Listserver help............: mailto:adtools-request@xxxxxxxxxxxxx?Subject=HELP

Other related posts: