[comp.sys.sequent] Several GNU problems

gustav@arp.anu.edu.au (Zdzislaw Meglicki) (03/07/91)

Hi,

I have a problem trying to compile and test libg++-1.39.0 on the
Sequent Symmetry S27 running DYNIX 3.0.17.9. Here is the problem:

When I compile it with 

#XTRAFLAGS = -DNO_LIBGXX_MALLOC

i.e., with NO_LIBGXX_MALLOC commented out, then when running the tests
the following programs work:

   tBag tBitString tComplex tCurses tDeque tFix tGetOpt tMap tPQ
   tQueue tRational tSet tStack tString

and the following dump the core:

   tBitSet tFile tFix16 tFix24 tInteger tLList tObstack tPlex
   tRandom tVec

When the library is compiled with NO_LIBGXX_MALLOC activated, i.e.:

XTRAFLAGS = -DNO_LIBGXX_MALLOC

then exactly the opposite happens, i.e., programs that worked previously
dump the core and those that dumped the core previously work.

My gcc is _not_ using the supplied malloc relying instead on DYNIX
malloc, i.e., it's been compiled with:

# ALLOCA = alloca.o
# MALLOC = malloc.o

commented out. I am using GNU's assembler and loader, there do not
seem to be any problems with these during the compilation stage.
I have compiled g++ and libg++ twice, the first time with 

MALLOC = malloc.o

uncommented, and the second time with MALLOC commented out, but the test
behaviour described above was unchanged. (I have not remade gcc itself
though to use the supplied malloc and alloca).

I would be most grateful for your advice. 

=======================================================================
Some simple libg++ bugs report:
=======================================================================

1)

During installation I have found the following problems in g++ source
and libg++ source itself: DYNIX does not provide a header file

	string.h

Many files in g++-1.39.0 source tried to include that file regardless.
There is an elegant #ifdef in cplus-dem.c which fixes this problem,
but which does not appear in other files:

#ifdef USG
#include <memory.h>
#include <string.h>
#else
#include <strings.h>
#define memcpy(s1, s2, n) bcopy ((s2), (s1), (n))
#define memcmp(s1, s2, n) bcmp ((s2), (s1), (n))
#define strchr index
#define strrchr rindex
#endif

I have copied and pasted that part of code in place of bare 

#include <string.h>

in cplus-lex.c, which is using strchr. As to other files I solved the
problem by making a symbolic link: string.h -> strings.h in my /usr/include.

2)

In libg++-1.39.0/Makefile the line defining "all" was:

all: src tests genclass etc gperf

Yet, genclass is needed during the tests. I have changed that to:

all: src genclass tests # etc gperf

(since I can't get through tests, I didn't bother about etc, and gperf)

=========================================================================
Bug reports about gas-1.38 -> please pass it to the concerned
=========================================================================

1)

The Makefile recommends using for the Sequent:

        G0 = -g -I. -DUSE_SYSTEM_HDR -DEXEC_VERSION=1

The option EXEC_VERSION is used _only_ in write.c:

#ifdef EXEC_VERSION
  md_number_to_chars((char *)&the_exec.a_version,EXEC_VERSION,sizeof(the_exec.a_
version));
#endif

where (in the same file, i.e., write.c)

        static struct exec      the_exec;

But in a.out.gnu.h struct exec is defined as follows:

struct exec
{
  unsigned long a_info;         /* Use macros N_MAGIC, etc for access */
  unsigned a_text;              /* length of text, in bytes */
  unsigned a_data;              /* length of data, in bytes */
  unsigned a_bss;               /* length of uninitialized data area for file, i
n
 bytes */
  unsigned a_syms;              /* length of symbol table data in file, in bytes
*/
  unsigned a_entry;             /* start address */
  unsigned a_trsize;            /* length of relocation info for text, in bytes
*
/
  unsigned a_drsize;            /* length of relocation info for data, in bytes
*
/
};

In other words, there is no member a_version. The word "a_version" is only
used in write.c in the context specified above.

Inspection of the source revealed that the option USE_SYSTEM_HDR is not
used anywhere (sic!) instead the definition of structure exec is flanked
by #ifdef __STRUCT_EXEC_OVERRIDE__. However, that part of the code does
not include appropriate <exec.h> if __STRUCT_EXEC_OVERRIDE__ is activated.

I have replaced the above definition of exec with the following:

---------------------

#ifndef __STRUCT_EXEC_OVERRIDE__

struct exec
{
  unsigned long a_info;         /* Use macros N_MAGIC, etc for access */
  unsigned a_text;              /* length of text, in bytes */
  unsigned a_data;              /* length of data, in bytes */
  unsigned a_bss;               /* length of uninitialized data area for file, i
n bytes */
  unsigned a_syms;              /* length of symbol table data in file, in bytes
 */
  unsigned a_entry;             /* start address */
  unsigned a_trsize;            /* length of relocation info for text, in bytes
*/
  unsigned a_drsize;            /* length of relocation info for data, in bytes
*/
};

#else

#include <exec.h>
#define a_info a_magic

#endif /* __STRUCT_EXEC_OVERRIDE__ */

------------------------

Then a couple of lines below:

------------------------

#ifndef __STRUCT_EXEC_OVERRIDE__
#define OMAGIC 0407
#endif
/* Code indicating pure executable.  */
#define NMAGIC 0410
/* Code indicating demand-paged executable.  */
#ifndef __STRUCT_EXEC_OVERRIDE__
#define ZMAGIC 0413
#endif

-----------------------

and in the Makefile itself:

G0 = -g -I. -DUSE_SYSTEM_HDR -DEXEC_VERSION=1 -D__STRUCT_EXEC_OVERRIDE__

I have then copied a.out.gnu.h modified in this way from the gas directory
to the loader directory, and remade both ld and gas.

==========================================================================

-- 
   Gustav Meglicki, gustav@arp.anu.edu.au,
   Automated Reasoning Project, RSSS, and Plasma Theory Group, RSPhysS,
   The Australian National University, G.P.O. Box 4, Canberra, A.C.T., 2601, 
   Australia, fax: (Australia)-6-249-0747, tel: (Australia)-6-249-0158