🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Andrew Vignaux Sun, 25 Sep 1988 05:59
An old problem with "Hello world"
#1459
Author: Andrew Vignaux
Date: Sun, 25 Sep 1988 05:59
39 lines
2021 bytes
Hi, I have a problem with GNU C++ version 1.22.1 (vax) compiled by GNU C
version 1.22 with GNU as and ld++.  This is not a bug report -- it should
be old news :-).

The problem has been reported in bug-g++ but I missed any fix (if it was
posted) before I had to unsubscribe due to the volume.  I would like to
know the way this has been fixed in later versions.

hello.cc
	#include <stream.h>
	main()
	{
	    cout << "Hello world\n";
	}

/usr/local/lib/gcc-c++ /tmp/cc020557.cpp -quiet -dumpbase hello.cc -noreg \
                       -version -o /tmp/cc020557.s

produces no output [GUESS ALERT] because the constructor for cout is not
being run.  This is because the only symbol connecting "hello.o" with
"stream.o" in "libg++.a" is the Common symbol "cout" and the loader does
not force stream.o to be linked in this case.  The ld++ ctor collecter
misses the fact that __GLOBAL_$I$stream_cc needs to be included in the
___CTOR_LIST__.  Things work fine if you write:
	    cout << "You are number " << 6;
because ld++ has to link in stream.o.  Ok, ok... you knew all that :-)

My questions is "what was the fix".  If it can be described in a few
paragraphs of english or a few pages of code I would love to see it.  I
already know that the best way to solve my problem is to upgrade to the
latest version.

Please respond by email as I am no longer subscribed to the list/group.

Thanks.

Andrew.
------------------------------------------------------------------------------
Domain address: andrew@comp.vuw.ac.nz   Path address: ...!uunet!vuwcomp!andrew
An old problem with "Hello world"
#1483
Author: Michael Tiemann
Date: Fri, 07 Oct 1988 05:29
6 lines
749 bytes
The problem was in varasm.c.  The trick is to make variables which
need to be initialized at the file level appear to be in initialized
data, rather than in uninitialized data.  GNU ld will not load the
contents of a library file just for .bss space.

Michael
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads