patches/gcc/3.3/gcc-3.3-libstdc++-v3-dg.exp.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.3/gcc-3.3-libstdc++-v3-dg.exp.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,54 @@
     1.4 +Without this patch, the command
     1.5 +
     1.6 +RUNTESTFLAGS=--target=powerpc-750-linux-gnu -v -v -v -v make check-target-libstdc++-v3
     1.7 +
     1.8 +fails in two ways:
     1.9 +1. the -L option meant to locate the testsuite directory is incorrect, and
    1.10 +2. the wrong compiler is invoked, causing all sorts of havoc, not least of which
    1.11 +is the native compiler is invoked when we really wanted to invoke the cross-compiler
    1.12 +we just built.
    1.13 +
    1.14 +Here's an example log of the problem in action.  Every testcase fails, this shows just one:
    1.15 +-------------
    1.16 +Invoking the compiler as g++ -ggdb3 -DDEBUG_ASSERT -I/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite /home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc   -g -O2 -DDEBUG_ASSERT  -L/testsuite -lv3test -lm  -o ./binders.exe
    1.17 +compiler exited with status 1
    1.18 +output is:
    1.19 +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h: In method `void binder2nd<mem_fun1_ref_t<void,Elem,int> >::operator ()(const Elem &) const':^M
    1.20 +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_algo.h:83:   instantiated from `for_each<Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> > >(Elem *, Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> >)'^M
    1.21 +/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc:43:   instantiated from here^M
    1.22 +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:224: conversion from `const Elem' to `Elem &' discards qualifiers^M
    1.23 +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:622: in passing argument 1 of `mem_fun1_ref_t<void,Elem,int>::operator ()(Elem &, int) const'^M
    1.24 +...
    1.25 +FAIL: 20_util/binders.cc (test for excess errors)
    1.26 +WARNING: 20_util/binders.cc compilation failed to produce executable
    1.27 +-------------
    1.28 +
    1.29 +And here's the patch.  I'm not happy with it, and it probably gets some cases wrong,
    1.30 +but it seems to work for the common native case and for my cross-compiler case.
    1.31 +
    1.32 +--- gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old	Sun Jul 13 10:42:01 2003
    1.33 ++++ gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp	Sun Jul 13 11:39:54 2003
    1.34 +@@ -46,8 +46,23 @@
    1.35 +     global gluefile wrap_flags
    1.36 +     global ld_library_path
    1.37 +     global tool_root_dir
    1.38 ++    global target_triplet
    1.39 + 
    1.40 +     set blddir [lookfor_file [get_multilibs] libstdc++-v3]
    1.41 ++    if { $blddir == "" } {
    1.42 ++        set multilibs [get_multilibs]
    1.43 ++        # FIXME: assume multilib only one level deep
    1.44 ++        set multisub [file tail $multilibs]
    1.45 ++        verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir"
    1.46 ++        set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"]
    1.47 ++    }
    1.48 ++    if { $blddir == "" } {
    1.49 ++        verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs"
    1.50 ++        set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"]
    1.51 ++    }
    1.52 ++    if { $blddir == "" } {
    1.53 ++         error "Can't find libstdc++-v3"
    1.54 ++    }
    1.55 + 
    1.56 +     # By default, we assume we want to run program images.
    1.57 +     global dg-do-what-default