This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: ld/testsuite/ld-selective to handle g++ V3 ABI


As we all know, g++ 3.0 has a new ABI and name mangling.  The existing
C++ selective tests don't work with the g++ V3 ABI.

I have tested this patch, by running `make check' in an already built
binutils 2.11 branch tree against gcc 2.95.3, gcc 3.0 and gcc mainline
on i386-unknown-freebsd4.3.  And against binutils mainline as
described in related e-mail.

Although it took some time to come up with this approach, some of this
may appear like a hack.  Rationale: (1) I didn't want to change the
ABI of ld_nm (i.e. confine this patch to the one set of test cases
that care about mangling issues). (2) Due to the complexity of the ABI
differences, I only convert those V2 demangled names to V3 style when
current test cases actually care.  If we ever want to add cases that
look for the correct deletion and retention of vtables, type info
nodes, methods with non-trivial paramater lists, etc more work will
need to be done here.

Regards,
Loren

2001-07-24  Loren J. Rittle  <ljrittle@acm.org>

	* ld-selective/selective.exp: Support g++ V3 ABI (along side
	the old ABI).  Make comparisons against normalized (to
	V3-style) demangled nm output.

Index: ld-selective/selective.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-selective/selective.exp,v
retrieving revision 1.11.2.5
diff -c -r1.11.2.5 selective.exp
*** selective.exp	2001/06/11 10:05:14	1.11.2.5
--- selective.exp	2001/07/24 09:18:04
***************
*** 46,54 ****
    {selective1 C 1.c {} {} {dropme1 dropme2} {}}
    {selective2 C 2.c {} {} {foo} {mips*-*}}
    {selective3 C 2.c {-u foo} {foo} {{foo 0}} {mips*-*}}
!   {selective4 C++ 3.cc {} {start foo__1A foo__1B} {bar__1A} {mips*-*}}
!   {selective5 C++ 4.cc {} {} {foo__1B foo__1A} {mips*-*}}
!   {selective6 C++ 5.cc {} {} {foo__1B foo__1A dropme1__Fv dropme2__Fv} {*-*-*}}
  }
  
  set cflags "-w -O -ffunction-sections -fdata-sections"
--- 46,55 ----
    {selective1 C 1.c {} {} {dropme1 dropme2} {}}
    {selective2 C 2.c {} {} {foo} {mips*-*}}
    {selective3 C 2.c {-u foo} {foo} {{foo 0}} {mips*-*}}
!   {selective4 C++ 3.cc {} {start a A::foo() B::foo()} {A::bar()} {mips*-*}}
!   {selective5 C++ 4.cc {} {start a A::bar()} {A::foo() B::foo()} {mips*-*}}
!   {selective6 C++ 5.cc {} {start a A::bar()}
!     {A::foo() B::foo() dropme1() dropme2()} {*-*-*}}
  }
  
  set cflags "-w -O -ffunction-sections -fdata-sections"
***************
*** 111,119 ****
--- 112,134 ----
  	continue
      }
  
+     # Make nm demangle names (this is the best I found without changing API)
+     global NMFLAGS
+     set OLDNMFLAGS "$NMFLAGS"
+     set NMFLAGS "$NMFLAGS --demangle"
+     
      if ![ld_nm $nm $ldfile] {
  	unresolved $testname
  	continue
+     }
+ 
+     set NMFLAGS "$OLDNMFLAGS"
+ 
+     # Must make V2 demangled names look like V3
+     foreach nm_output_key [array names nm_output] {
+ 	if [regsub \\(void\\) $nm_output_key () new_nm_output_key] {
+ 	    set nm_output($new_nm_output_key) nm_output($nm_output_key)
+ 	}
      }
  
      # Check each mandated symbol and optionally mandated values. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]