From: steve%eowyn@gte.com (Steve Preston)
Subject: bug in gen-params.
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 30 Sep 1992 09:09:55 GMT

On a HP9000/720, HP-UX (A.08.07), using gcc-2.2.2 (configured for
hppa1.1-hp-hpux)I had several problems making a good version of
libg++.a :

Problem 1) After saying 'configure hp700', which seemed to work,
running make successfully made in the libiberty/ directory, but failed
in the libg++/ directory with this output:
------------------------------------------------------------------------
	./utils/gen-params DOLLAR_IN_LABEL=1 >tmp-params.h
nm:  dummy.o:  cannot open
nm:  dummy.o:  cannot open
nm failed to find FUNC in dummy.o!
./utils/gen-params: -1: bad number
------------------------------------------------------------------------

Solution 1) cd libg++, then run make.  This is probably the fault of
HP's make.

Problem 2) Error message from gcc about duplicate definition of 'abs'
in /usr/include/stdlib.h and /usr/include/math.h, and, later, about
the inline defintion of pow(double,int) in /usr/include/math.h

Solution 2) This was HP's fault.  I had to change stdlib.h and math.h.

Problem 3) Warning messages from gcc about implicit declarations of
'bcopy', 'bcmp', 'bzero', 'index' and 'isinf'.  These can be ignored,
but I wanted to see if I could eliminate them.

Solution 3) Change libg++/src/std.h to include declarations of bcopy,
bzero, bcmp, and index.  There are declarations in
/usr/include/strings.h but they used char* instead of void*, which
caused problems when these functions were used in the code.  I also
found an inline definition of isinf in the gcc headers, and put this
also into std.h.
  For what it's worth: The HP man pages said that new applications
should use memcmp, memmove and memset instead of bcmp, bcopy and
bzero.

At this point, libg++ would successfully 'make'.

PROBLEM 4) This was the hard one.  When I did a 'make install' the
test-install part failed with this linker error
------------------------------------------------------------------------
ld: Unsatisfied symbols:
   _vt.filebuf (data)
collect: /bin/ld returned 1 exit status
------------------------------------------------------------------------

A little searching and I found this snippit in
libg++/iostream/stdstrbufs.C:
------------------------------------------------------------------------
#if !defined(vt_filebuf)
#ifndef __GNUG__
// This works for cfront.
#define vt_filebuf __vtbl__7filebuf
extern char vt_filebuf[1];
#elif _G_DOLLAR_IN_LABEL
extern char vt_filebuf[1] asm(UNDERSCORE "_vt$filebuf");
#else
extern char vt_filebuf[1] asm(UNDERSCORE "_vt.filebuf");
#endif
#endif /* !defined(vt_filebuf) */
------------------------------------------------------------------------
Then I remembered that other line above from the make:
	./utils/gen-params DOLLAR_IN_LABEL=1 >tmp-params.h
This was followed by this line:
	mv tmp-params.h _G_config.h
A quick look at _G_config.h showed that there was NO #define of 
_G_DOLLAR_IN_LABEL.  Where it should be is the line 
    #define _G_ 1 1

SOLUTION 4)
I found the bug (just as I was writing this).  In these lines of
gen-params:
------------------------------------------------------------------------
  if test -n "${DOLLAR_IN_LABEL}" ; then
    echo "#define ${macro_prefix} ${DOLLAR_IN_LABEL} ${DOLLAR_IN_LABEL}"
  elif test "`${CONFIG_NM} dummy.o | grep 'vt[$$]filebuf'`" != ""; then
    echo "#define ${macro_prefix}DOLLAR_IN_LABEL 1"
  elif test "`${CONFIG_NM} dummy.o | grep 'vt[.]filebuf'`" != ""; then
    echo "#define ${macro_prefix}DOLLAR_IN_LABEL 0"
  else
    echo "${CONFIG_NM} failed to find vt[.\$]filebuf in dummy.o!" 1>&2; exit 1
  fi
------------------------------------------------------------------------
The second line needs to be changed to
------------------------------------------------------------------------
    echo "#define ${macro_prefix}DOLLAR_IN_LABEL ${DOLLAR_IN_LABEL}"
------------------------------------------------------------------------
--
Steve Preston (scp2@gte.com)

Newsgroups: gnu.g++.lib.bug