patches/gcc/3.3/gcc-3.2.3-g++.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.2.3-g++.exp.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,98 @@
     1.4 +g++ testsuite fixes for cross-compilers, Dan Kegel, Ixia Communications, 12 July 2003
     1.5 +
     1.6 +The first hunk fixes the error
     1.7 +
     1.8 +/testsuite_flags: /testsuite_flags: No such file or directory
     1.9 +    while executing
    1.10 +"exec sh ${odir_v3}/testsuite_flags --build-includes"
    1.11 +    (procedure "g++_include_flags" line 21)
    1.12 +    invoked from within
    1.13 +"g++_include_flags [get_multilibs] "
    1.14 +    (procedure "g++_init" line 63)
    1.15 +    invoked from within
    1.16 +"${tool}_init $test_file_name"
    1.17 +    (procedure "runtest" line 19)
    1.18 +    invoked from within
    1.19 +"runtest $test_name"
    1.20 +    ("foreach" body line 42)
    1.21 +    invoked from within
    1.22 +...
    1.23 +make[1]: [check-g++] Error 1 (ignored)
    1.24 +
    1.25 +The fix isn't especially pretty, but it worked for me, and can't hurt the
    1.26 +more common native compiler case.  Maybe someone who knows the code better 
    1.27 +can come up with a better fix.
    1.28 +
    1.29 +The second hunk fixes the error
    1.30 +
    1.31 +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian
    1.32 +
    1.33 +when trying to compile g++ testcases (!); setting up
    1.34 +the shared library environment when running crosstests of g++ 
    1.35 +should either be done by a special board file, or by
    1.36 +setting up a remote chroot environment (see http://kegel.com/crosstool),
    1.37 +not by blithely setting LD_LIBRARY_PATH on the local system.
    1.38 +
    1.39 +--- gcc-3.2.3/gcc/testsuite/lib/g++.exp.old	Fri Jul 11 15:42:47 2003
    1.40 ++++ gcc-3.2.3/gcc/testsuite/lib/g++.exp	Sat Jul 12 12:57:07 2003
    1.41 +@@ -72,6 +72,8 @@
    1.42 + #
    1.43 + proc g++_include_flags { paths } {
    1.44 +     global srcdir
    1.45 ++    global objdir
    1.46 ++    global target_triplet
    1.47 +     global HAVE_LIBSTDCXX_V3
    1.48 +     global TESTING_IN_BUILD_TREE
    1.49 + 
    1.50 +@@ -90,6 +92,20 @@
    1.51 + 
    1.52 +     if { ${HAVE_LIBSTDCXX_V3} } {
    1.53 +       set odir_v3 [lookfor_file ${gccpath} libstdc++-v3]
    1.54 ++      if { $odir_v3 == "" } {
    1.55 ++          verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir"
    1.56 ++	  # first assume no multilibs
    1.57 ++          set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"]
    1.58 ++      }
    1.59 ++      if { $odir_v3 == "" } {
    1.60 ++          verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib"
    1.61 ++	  # assume multilib only one level deep
    1.62 ++          set multisub [file tail $gccpath]
    1.63 ++          set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"]
    1.64 ++      }
    1.65 ++      if { $odir_v3 == "" } {
    1.66 ++           error "Can't find libstdc++-v3"
    1.67 ++      }
    1.68 +       append flags [exec sh ${odir_v3}/testsuite_flags --build-includes]
    1.69 +     } else {
    1.70 +       set odir_v2 [lookfor_file ${gccpath} libstdc++]
    1.71 +@@ -192,16 +192,20 @@
    1.72 +       }
    1.73 +     }
    1.74 + 
    1.75 +-    # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
    1.76 +-    # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
    1.77 +-    # (for the 64-bit ABI).  The right way to do this would be to modify
    1.78 +-    # unix.exp -- but that's not an option since it's part of DejaGNU
    1.79 +-    # proper, so we do it here.  We really only need to do 
    1.80 +-    # this on IRIX, but it shouldn't hurt to do it anywhere else.
    1.81 +-    setenv  LD_LIBRARY_PATH     $ld_library_path
    1.82 +-    setenv  SHLIB_PATH          $ld_library_path
    1.83 +-    setenv  LD_LIBRARYN32_PATH  $ld_library_path
    1.84 +-    setenv  LD_LIBRARY64_PATH   $ld_library_path
    1.85 ++    if {![is_remote target]} {
    1.86 ++      # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
    1.87 ++      # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
    1.88 ++      # (for the 64-bit ABI).  The right way to do this would be to modify
    1.89 ++      # unix.exp -- but that's not an option since it's part of DejaGNU
    1.90 ++      # proper, so we do it here.  We really only need to do 
    1.91 ++      # this on IRIX, but it shouldn't hurt to do it anywhere else.
    1.92 ++
    1.93 ++      # Doing this causes us to be unable to run cross-compilers.
    1.94 ++      setenv  LD_LIBRARY_PATH     $ld_library_path
    1.95 ++      setenv  SHLIB_PATH          $ld_library_path
    1.96 ++      setenv  LD_LIBRARYN32_PATH  $ld_library_path
    1.97 ++      setenv  LD_LIBRARY64_PATH   $ld_library_path
    1.98 ++    }
    1.99 + 
   1.100 +     return "$flags"
   1.101 + }