Test case which displays problem found in libstdc++-v3 effort

Loren James Rittle rittle@latour.rsch.comm.mot.com
Fri Jun 16 18:35:00 GMT 2000


There is talk of using -ffunction-sections -fdata-sections (to compile
the libstdc++-v3 library code) and to suggest -Wl,--gc-sections (for
any static links against the library) on any platforms which supports
those options.  On those platforms, the test suite for libstdc++-v3
would always add -Wl,--gc-sections for links.

The following small test case fails on:

i686-pc-linux-gnu with gcc 2.95.1 using ld 2.9.5.
i686-unknown-freebsdelf with gcc 2.95.2 (+branch patches) using ld 2.9.5
i686-unknown-freebsd3.4 with mainline CVS gcc using ld 2.10
sparc-sun-solaris2.6 with gcc 2.95.2 using ld 2.10

with this command line (which I tried to capture in the proper place
and manner of the testsuite in the actual patch I am submitting):

g++ -ffunction-sections -fdata-sections -Wl,--gc-sections -static 6.cc; a.out

2000-06-16  Loren J. Rittle  <ljrittle@acm.org>

        * ld-selective/selective.exp:  Add test6.
        * ld-selective/6.cc: New file.

Index: ld-selective/selective.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-selective/selective.exp,v
retrieving revision 1.3.2.1
diff -c -p -r1.3.2.1 selective.exp
*** selective.exp	2000/04/11 23:04:03	1.3.2.1
--- selective.exp	2000/06/17 01:09:45
*************** set test2 "selective2"
*** 32,37 ****
--- 32,38 ----
  set test3 "selective3"
  set test4 "selective4"
  set test5 "selective5"
+ set test6 "selective6"
  
  set cflags "-w -O2 -ffunction-sections -fdata-sections" 
  set cxxflags "-fvtable-gc -fno-exceptions -fno-rtti"
*************** if ![ld_simple_link $ld tmpdir/4.x "$ldf
*** 169,174 ****
--- 170,196 ----
            } else {
  	      pass $test5
               }
+ 	}
+     }
+ }
+ 
+ if [isnative] {
+     if ![ld_compile "$CC $cflags $cxxflags -fexceptions" \
+ 	    $srcdir/$subdir/6.cc tmpdir/6.o] {
+         unresolved $test6
+         return
+     }
+ 
+     if ![ld_link $ld tmpdir/6.x "$ldflags tmpdir/6.o"] {
+         fail $test6
+     } else {
+ 	catch "exec tmpdir/6.x" exec_output
+ 	if ![string match "" $exec_output] then {
+ 	    send_log "$exec_output\n"
+             verbose "$exec_output" 1
+             fail $test6
+ 	} else {
+ 	    pass $test6
  	}
      }
  }
*** /dev/null	Fri Jun 16 19:59:00 2000
--- ld-selective/6.cc	Fri Jun 16 19:19:21 2000
***************
*** 0 ****
--- 1,9 ----
+ int main (void)
+ {
+   try
+     {
+       throw 1;
+     }
+   catch (...) {}
+   return 0;
+ }


More information about the Libstdc++ mailing list