This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: clean up assembler feature tests; get rid of acconfig.h


On Sat, Jul 12, 2003 at 12:46:14PM -0700, Zack Weinberg wrote:
> This has been tested on an i386 target.  There may be typos in the
> tests specific to other targets.  Please let me know if so.
> 
>         * aclocal.m4 (gcc_AC_CHECK_TYPE): Clone of AC_CHECK_TYPE,
>         uses three-argument AC_DEFINE so no acconfig.h entries are
>         needed.
>         (_gcc_COMPUTE_GAS_VERSION): Also provide gcc_cv_gas_vers
>         which contains the GAS version number as a scaled integer.
>         (gcc_GAS_VERSION_GTE_IFELSE): Use gcc_cv_gas_vers.  Add
>         ability to check for ELF assembler.
>         (gcc_GAS_CHECK_FEATURE): New macro.
>         * configure.in: Use gcc_AC_CHECK_TYPE.  Rewrite all
>         assembler feature checks using gcc_GAS_CHECK_FEATURE.
>         Use three-argument AC_DEFINE everywhere.
>         * acconfig.h: Deleted.
>         * config.in, configure: Regenerate.

This patch broke offsetable %lo() check, such that it will likely
succeed when it should not (thus creating hard to discover bugs
in sparc 64-bit code) and not succeed when it should.
...
> -    AC_CACHE_CHECK([for assembler offsetable %lo() support],
> -	gcc_cv_as_offsetable_lo10, [
> -	gcc_cv_as_offsetable_lo10=unknown
> -	if test "x$gcc_cv_as" != x; then
> -	    # Check if assembler has offsetable %lo()
> -	    echo "or %g1, %lo(ab) + 12, %g1" > conftest.s
> -	    echo "or %g1, %lo(ab + 12), %g1" > conftest1.s
> -	    if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \
> -		    > /dev/null 2>&1 &&
> -	       $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \
> -		    > /dev/null 2>&1; then
> -		if cmp conftest.o conftest1.o > /dev/null 2>&1; then
> -		    gcc_cv_as_offsetable_lo10=no
> -		else
> -		    gcc_cv_as_offsetable_lo10=yes
> -		fi
...
> +    gcc_GAS_CHECK_FEATURE([offsetable %lo()],
> +      gcc_cv_as_sparc_offsetable_lo10,,
> +      [-xarch=v9],
> +[.text
> +	or %g1, %lo(ab) + 12, %g1
> +	or %g1, %lo(ab + 12), %g1],
> +      [if test x$gcc_cv_objdump != x \
> +       && %gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
> +          | grep ' 82106000 82106000' > /dev/null 2>&1; then
> +	 gcc_cv_as_offsetable_lo10=yes
> +       fi],
> +       [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
> +	         [Define if your assembler supports offsetable %lo().])])

The old test was testing whether a) both assembly snippets
actually assembled b) they are NOT identical.
When assembler supports offsetable %lo,
%lo(ab) + 12 means (ab & 0x3ff) + 12 while %lo(ab + 12) means
((ab + 12) & 0x3ff) and %lo(ab + 4) + 8 means
((ab + 4) & 0x3ff) + 8.
Grepping .text section of .o file is not useful, what really matters is
what relocations have been created.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]