*BSD News Article 75977


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!usenet.eel.ufl.edu!hookup!news.nstn.ca!coranto.ucs.mun.ca!news.unb.ca!usenet
From: Peter Howlett <Peter.Howlett@ASG.unb.ca>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: GNU ld for linking with 2.7.2 STL
Date: Mon, 12 Aug 1996 14:25:42 -0300
Organization: Atlantic Systems Group
Lines: 71
Message-ID: <320F6916.41C6@ASG.unb.ca>
NNTP-Posting-Host: opie.asg.unb.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (X11; I; AIX 2)

We have difficulty linking some stl applications on FreeBSD2.1R
with 2.7.2. Compiling the same applications on other systems
(AIX, SunOS, Solaris, HPUX, OSF1) goes without a hitch. Some
constructors get instantiated twice, one problem I fixed by
including pragmas in the stl includes. I dont know if it is
a linking problem or a g++2.7.2 problem. (Problem still exists
with 2.7.2p)

I am trying to compile the GNU ld, however my experience with
linkers is limited. From binutils 2.7 I added a new genscript
for freebsd: i386fbsd.sh in the emulparams subdir. I copied
it from the i386nbsd.sh used by netbsd. It differs from the
regular i386bsd.sh like so:

i386bsd.sh-----------
SCRIPT_NAME=aout
OUTPUT_FORMAT="a.out-i386-bsd"
TARGET_PAGE_SIZE=0x1000
TEXT_START_ADDR=0
NONPAGED_TEXT_START_ADDR=0x1000
ARCH=i386
-----------------------------

The netbsd one I copied and renamed for freebsd looks like:
i386fbsd.sh----------
SCRIPT_NAME=aout
TEXT_START_ADDR=0
OUTPUT_FORMAT="a.out-i386-freebsd"
TARGET_PAGE_SIZE=0x1000
ARCH=i386
EXECUTABLE_SYMBOLS='__DYNAMIC = 0;'
---------------------

The only thing I changed from the i386nbsd.sh file was the 
OUTPUT_FORMAT name. As it is, this compiles, but the linker
gives many undefined references with libc.a from /usr/lib.
This is when compiling enquire from the gcc source, or even
a helo world. The messages are basic undef refs...

enquire.o(.text+0x1b): undefined reference to `longjmp'
enquire.o(.text+0x231): undefined reference to `setjmp'
enquire.o(.text+0x267): undefined reference to `setjmp'
enquire.o(.text+0x39b): undefined reference to `setjmp'
enquire.o(.text+0xa82): undefined reference to `strcmp'
enquire.o(.text+0x17ec): undefined reference to `setjmp'
enquire.o(.text+0x18d4): undefined reference to `setjmp'
enquire.o(.text+0x193f): undefined reference to `setjmp'
enquire.o(.text+0x19cb): undefined reference to `setjmp'
enquire.o(.text+0x1b81): undefined reference to `setjmp'
enquire.o(.text+0x1bb5): more undefined references to `setjmp' follow
/usr/lib/libc.a(getenv.o)(.text+0x6a): undefined reference to `strncmp'
/usr/lib/libc.a(startup_setlocale.o)(.text+0x47d): undefined reference
to `strcat'
/usr/lib/libc.a(startup_setlocale.o)(.text+0x472): undefined reference
to `strcat'
/usr/lib/libc.a(startup_setlocale.o)(.text+0x469): undefined reference
to `strcat'
/usr/lib/libc.a(startup_setlocale.o)(.text+0x45e): undefined reference
to `strcpy'
/usr/lib/libc.a(startup_setlocale.o)(.text+0x3ce): undefined reference
to `strcpy'

etc, etc, etc....

Any thoughts would be most welcome...

--------------------------------------------------------------------
Peter Howlett				Atlantic Systems Group
E-Mail: Peter.Howlett@ASG.unb.ca	Fredericton, N.B. Canada
http://www.ASG.unb.ca/personal/ph.html	Phone: (506) 447-3050
PGP Key ID: 60F2EEC1			Fax:   (506) 453-5004