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