Correct the order of multilib_flagsheads/hjl/pr59971
commitc5f065d3e55efcaf34f060a05ae2c08e8174cdf0
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 13 Feb 2015 16:28:26 +0000 (13 08:28 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 13 Feb 2015 16:28:26 +0000 (13 08:28 -0800)
treea8ae9fa9ad0085f73c01710d24452a73103961c1
parent213647b147e9461dc3d669c2bc64fbf8ac8e95be
Correct the order of multilib_flags

Some testcases need explicit GCC options to properly run, like
gcc.target/i386/sse2-init-v2di-2.c has

/* { dg-options "-O2 -msse4 -march=core2 -dp" } */

-march=core2 is specified explicitly.  But with multlib, like

make check-gcc RUNTESTFLAGS="--target_board='unix{-march=k8}'

-march=k8 is appended to the command line options, which overrides
the the command line options specified by dg-options.  multlib flags
should be placed at the beginning of the command line options, not at
the end.  This patch adds gcc_default_target_compile, which is
almost identical to default_target_compile in dejagnu, except that
it has

    if {[board_info $dest exists multilib_flags]} {
        set add_flags "[board_info $dest multilib_flags] $add_flags"
    }

instead of

    if {[board_info $dest exists multilib_flags]} {
        append add_flags " [board_info $dest multilib_flags]"
    }

It replaces default_target_compile with gcc_default_target_compile.
Tested on Linux/x86-64 with RUNTESTFLAGS="--target_board='unix{-m32,}'".

PR testsuite/59971
* lib/gcc-defs.exp (gcc_default_target_compile): New.  Replace
default_target_compile with gcc_default_target_compile.
gcc/testsuite/lib/gcc-defs.exp