🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #73515

Re: g++ and collect on a SUN (was: GNU can replace COFF?)

#73515
From: Simon J Gerraty
Date: Mon, 02 Sep 1991 04:10
239 lines
9136 bytes
In <1991Aug19.001547.19748@cpsc.ucalgary.ca> schenk@cpsc.ucalgary.ca (Eric Schenk) writes:
>In article <1991Aug16.053422.16246@melb.bull.oz.au> sjg@melb.bull.oz.au (Simon J Gerraty) writes:
>>I have gcc-1.39 and g++-1.39 and gdb-3.5 running on a COFF
>>system (sun386i) at home.  The trick is to use collect as
>>opposed to gnu-ld.
>> ...
>>At work I have gcc-1.40, g++-1.39 and gas-1.38 working on a Sun
>>SPARCstation.  This system is non-COFF, but I elected to use
>>collect rather than gnu-ld (a), because so far it works well
>>enough at home, and (b) the Sun ld handles shared libraries.

I also have gdb-3.98 running on the SPARC, but gave up on it for
the 386i after  wasting most of a day on it.

>This raises some question for me.
>I've tried to get collect to compile on a SUN 3 running SUNOS 4.1.1.
>but there are some missing defines (I've forgotten the exact difficulty,
>I gave up and used gnu-ld from the binutils distribution. I can 

I know it is the wrong place to post them but at the end of this
are some diffs for Makefile,gcc.c,collect.c and
config/tm-sparc.h
as far as I can tell they are the only changes I had to make.
Interestingly on the 386i ld copes with -r and -Bstatic, but the
SPARC (SunOS 4.1.1) ld vomits.  The patch to tm-sparc.h takes
care of that.

>Finally, if you do have collect running does it pose any problems?
>What do the cryptic comments about collect not doing
>constructors/destructors justice in the Makefile mean?

I can't really say.  I've not built anything huge yet using g++
(apart from libg++ but that doesn't count) packages like
InterViews and NIHCL just would not build with g++ (that's 3.0
InterViews).

*** /tmp/g++-1.39.0/Makefile	Mon Jan 14 12:42:19 1991
--- Makefile	Mon Aug 12 16:35:38 1991
***************
*** 50,56 ****
  # HAVE_UNISTD_H = -DNO_UNISTD_H
  
  # CFLAGS = -g -DSOS -DESKIT -O
! CFLAGS = -g -DGATHER_STATISTICS -O $(COFFLAGS) -B../gcc-test/ -DFIELD_XREF
  CC = gcc
  BISON = bison
  BISONFLAGS = -v -d
--- 50,56 ----
  # HAVE_UNISTD_H = -DNO_UNISTD_H
  
  # CFLAGS = -g -DSOS -DESKIT -O
! CFLAGS = -g $(PIPE) -DGATHER_STATISTICS -O $(COFFLAGS) -B../gcc-test/ -DFIELD_XREF -DUSE_COLLECT
  CC = gcc
  BISON = bison
  BISONFLAGS = -v -d
***************
*** 77,83 ****
  # break with USG defined), may need to define this.
  # USG_STDIO = -DUSG_STDIO
  
! prefix=/tools/gnu
  
  # Directory where sources are, from where we are.
  srcdir = .
--- 77,83 ----
  # break with USG defined), may need to define this.
  # USG_STDIO = -DUSG_STDIO
  
! prefix=/usr/local
  
  # Directory where sources are, from where we are.
  srcdir = .
***************
*** 102,108 ****
  # Directory to link to, when using the target `maketest'.
  DIR = ../gcc
  # this is the GNU CC build directory
! TDIR = ../gcc-test
  
  # End of variables for you to override.
  
--- 102,108 ----
  # Directory to link to, when using the target `maketest'.
  DIR = ../gcc
  # this is the GNU CC build directory
! TDIR = ../gcc #-test
  
  # End of variables for you to override.
  
***************
*** 133,139 ****
  # If your system's malloc() routine fails for any reason (as it does on
  # certain versions of Genix), try getting the files
  # malloc.c and getpagesize.h from GNU Emacs and un-comment the following line:
! MALLOC = malloc.o
  
  # If you are running GCC on an Apollo (SR10.x),
  # go into a Berkeley environment and use this:
--- 133,139 ----
  # If your system's malloc() routine fails for any reason (as it does on
  # certain versions of Genix), try getting the files
  # malloc.c and getpagesize.h from GNU Emacs and un-comment the following line:
! #MALLOC = malloc.o
  
  # If you are running GCC on an Apollo (SR10.x),
  # go into a Berkeley environment and use this:
***************
*** 209,215 ****
  
  # gnulib is not a target because a proper installation of GNU CC
  # will place it where g++ can find it.  Same with cpp
! all: crt1+.o g++ cc1plus ld++ g++filt # collect crt0+.o
  # On COFF systems, use the target below.
  # all: g++ cc1plus collect # crt0+.o crt1+.o
  
--- 209,217 ----
  
  # gnulib is not a target because a proper installation of GNU CC
  # will place it where g++ can find it.  Same with cpp
! #all: crt1+.o g++ cc1plus ld++ g++filt # collect crt0+.o
! #all: crt1+.o g++ cc1plus ld++ g++filt collect crt0+.o
! all: crt1+.o g++ cc1plus ld++ g++filt collect crt0+.o
  # On COFF systems, use the target below.
  # all: g++ cc1plus collect # crt0+.o crt1+.o
  
***************
*** 226,233 ****
  # enough to do right by all C++ static constructors, and it would
  # be better if you could just add support to GNU LD to handle
  # shared libraries.
! gcc.o: gcc.c $(CONFIG_H)
! 	$(CC) $(CFLAGS) $(INCLUDES) \
    -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
    -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" -c \
    `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
--- 228,235 ----
  # enough to do right by all C++ static constructors, and it would
  # be better if you could just add support to GNU LD to handle
  # shared libraries.
! gcc.o: gcc.c $(CONFIG_H) 
! 	$(CC) $(CFLAGS) -DNO_GNU_LD $(INCLUDES) \
    -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
    -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" -c \
    `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
***************
*** 291,297 ****
  	else \
  		COLLECT_OPTIONS=''; \
  	fi; \
! 	$(CC) -o collect $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) $(INCLUDES) $< -lg -lc $$COLLECT_LIBS
  
  collect2: collect2.c config.h
  	$(CC) -o collect2 collect2.c $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) $(INCLUDES) -lc
--- 293,299 ----
  	else \
  		COLLECT_OPTIONS=''; \
  	fi; \
! 	$(CC) -o collect $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) $(INCLUDES) collect.c -lg -lc #$$COLLECT_LIBS
  
  collect2: collect2.c config.h
  	$(CC) -o collect2 collect2.c $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) $(INCLUDES) -lc
*** /tmp/g++-1.39.0/collect.c	Mon Aug  6 14:12:52 1990
--- collect.c	Mon Aug 12 16:43:33 1991
***************
*** 115,120 ****
--- 115,124 ----
    fprintf (FILE, "\t.file\t\"%s\"\n", NAME);
  #endif
  
+ #ifndef ASM_INT_OP
+ #define ASM_INT_OP	"\t.long\t"
+ #endif
+   
  extern int xmalloc ();
  extern void free ();
  
*** /tmp/g++-1.39.0/gcc.c	Tue Aug 14 08:26:08 1990
--- gcc.c	Fri Aug 16 10:10:51 1991
***************
*** 303,310 ****
  char *collect_spec =
    "%{!c:%{!M*:%{!E:%{!S:collect -o %g.s %g.R\n\
  as %g.s -o %g.O\n\
! ld %{o*} %g.R %g.O\n\
  }}}}";
  
  /* Here is the spec for running the linker, after compiling all files.  */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l\
--- 303,320 ----
  char *collect_spec =
    "%{!c:%{!M*:%{!E:%{!S:collect -o %g.s %g.R\n\
  as %g.s -o %g.O\n\
! ld %{!e*:-e start} -dc -dp %{g:-Bstatic} %{static:-Bstatic} %{Bstatic} %{o*} %g.R %g.O\
!  %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
!  %{y*} \
!  %{L*} %{!nostdlib:-lg++ gnulib%s %{g:-lg} %L}\
! \n\
  }}}}";
+ 
+ /* was
+    ld -Bstatic -e _start %{o*} %g.R %g.O\n\
+    instead of
+    ld %{o*} %g.R %g.O\n\
+  */
  
  /* Here is the spec for running the linker, after compiling all files.  */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l\
*** /tmp/g++-1.39.0/config/tm-sparc.h	Sat Apr 13 10:29:44 1991
--- config/tm-sparc.h	Thu Aug 15 17:20:24 1991
***************
*** 30,37 ****
     Also, it is hard to debug with shared libraries,
     so don't use them if going to debug.  */
  
  #define LINK_SPEC "%{!e*:-e start} -dc -dp %{g:-Bstatic} %{static:-Bstatic} %{Bstatic}"
! 
  /* Special flags to the Sun-4 assembler when using pipe for input.  */
  
  #define ASM_SPEC " %{pipe:-} "
--- 30,44 ----
     Also, it is hard to debug with shared libraries,
     so don't use them if going to debug.  */
  
+ #ifdef USE_COLLECT
+ /*
+  * <sjg@sun0>
+  * we will invoke ld with -r, so can't use -Bstatic (yet)
+  */
+ #define LINK_SPEC "%{!e*:-e start} -dc -dp"
+ #else
  #define LINK_SPEC "%{!e*:-e start} -dc -dp %{g:-Bstatic} %{static:-Bstatic} %{Bstatic}"
! #endif /* USE_COLLECT */
  /* Special flags to the Sun-4 assembler when using pipe for input.  */
  
  #define ASM_SPEC " %{pipe:-} "
-- 
Simon J. Gerraty		<sjg@melb.bull.oz.au>

#include <disclaimer,_witty_comment>
Technical Details
Message-ID: <1991Sep2.041046.1876@melb.bull.oz.au>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!iraun1.ira.uka.de!yale.edu!think.com!news.bbn.com!mips2!cass.ma02.bull.com!ladcgw.ladc.bull.com!melb.bull.oz.au!sjg
References: <1991Aug04.151415.706@admiral.uucp> <1991Aug16.053422.16246@melb.bull.oz.au> <1991Aug19.001547.19748@cpsc.ucalgary.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,98181166d5e1d0a1
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 1991-09-03 13:01:43 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!iraun1.ira.uka.de!yale.edu!think.com!news.bbn.com!mips2!cass.ma02.bull.com!ladcgw.ladc.bull.com!melb.bull.oz.au!sjg
From: sjg@melb.bull.oz.au (Simon J Gerraty)
Newsgroups: gnu.misc.discuss
Subject: Re: g++ and collect on a SUN (was: GNU can replace COFF?)
Message-ID: <1991Sep2.041046.1876@melb.bull.oz.au>
Date: 2 Sep 91 04:10:46 GMT
References: <1991Aug04.151415.706@admiral.uucp> <1991Aug16.053422.16246@melb.bull.oz.au> <1991Aug19.001547.19748@cpsc.ucalgary.ca>
Organization: Bull HN Information Systems Australia.
Lines: 239