This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

win32 libio/gen-param fix



The detection of VTABLE_LABEL_PREFIX breaks on win32 due to the existence 
of unique sections containing the same pattern. This is not an issue in
the release branch, where the vtables are not emitted in linkonce
sections.

Here's what happens:
  
  % i586-cygwin32-nm dummy.o  | grep filebuf
  00000000 d .data$_vt$7filebuf
  00000000 t .text$__tf7filebuf
  00000000 T ___tf7filebuf
  00000010 C ___ti7filebuf
  00000000 D __vt$7filebuf
  00000000 T _foo__7filebuf

The sed pattern matches the first one, .data$_vt$7filebuf, instead of the
intended one, _vt$7filebuf, and we end up with the incorrect value of
VTABLE_LABEL_PREFIX.

The following trivial patch simply deletes the unique sections from the nm 
output to avoid this pitfall.

Mon Feb  8 10:35:08 1999  Mumit Khan  <khan@xraylith.wisc.edu>

	* gen-params (VTABLE_LABEL_PREFIX): Handle windows32. 

Index: gen-params
===================================================================
RCS file: /mounts/sda7/src/gnu/CVSROOT/egcs-dev/libio/gen-params,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 gen-params
--- gen-params	1999/02/07 23:35:54	1.1.1.1
+++ gen-params	1999/02/08 16:34:58
@@ -107,7 +107,9 @@ if test -z "${NAMES_HAVE_UNDERSCORE}" -o
     if test -z "${VTABLE_LABEL_PREFIX}" ; then
       # Determine how virtual function tables are named.  This is fragile,
       # because different nm's produce output in different formats.
-      ${CONFIG_NM} dummy.o >TMP
+      # On windows32, we also need to delete the unique sections
+      # (.data$_vt$*), otherwise we get the wrong result.
+      ${CONFIG_NM} dummy.o | ${SED} -e '/\.data[$_.]_vt\$7filebuf/d' >TMP
       if [ -n "`${SED} -n -e 's/ virtual table/nope/p' <TMP`" ] ; then
 	${CONFIG_NM} --no-cplus dummy.o >TMP 2>/dev/null ||
 	  ${CONFIG_NM} --no-demangle dummy.o >TMP 2>/dev/null ||


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