*BSD News Article 12517


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!copper!aspen.craycos.com!scott
From: scott@craycos.com (Scott Bolte)
Newsgroups: comp.os.386bsd.questions
Subject: cross-compiling (linking actually) using gnu tools
Message-ID: <1993Mar8.030202.26276@craycos.com>
Date: 8 Mar 93 03:02:02 GMT
Organization: Cray Computer Corporation
Lines: 69


	I could use some help setting up a cross compilation
	environment from a Sparc system to 386BSD using the GNU tools.
	I have everything working except for ld. Ideally I would like
	to get this going before ref.tfs.com goes away so I can verify
	that it all works.

	The parts that have been verified to work:

		gcc-2.3.3
		gas-1.38
		binutils-2.1
		   ranlib
		   ar

	And the only missing component is ld. It will link a binary
	without error messages. But when an attempt is made to run it
	on ref.tfs.com it complains: "./a.out: Cannot allocate memory."

	I have used objdump (from binutils 2.1) to see how a program
	linked on a sun (using the gnu loader) and one linked under
	386bsd (using the system loader) differ. The results are
	included below.

sun% objdump -f 386-main
386-main:     file format a.out-i386-bsd
architecture: i386, flags 0x000001be:
EXEC_P, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS, WP_TEXT, D_PAGED
start address 0x00000000

sun% objdump -f gnu-main
gnu-main:     file format a.out-i386-bsd
architecture: i386, flags 0x000001be:
EXEC_P, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS, WP_TEXT, D_PAGED
start address 0x00000004

	As you can see the start address for the second, the one that
	fails, is 0x4 instead of 0x0. (It also seems that the default
	loader on ref.tfs.com might be an old gnu loader. Can anyone
	verify this?)

	The loader has two emulation modes for a 386: i386aout and
	i386coff.  But the Binary File Descriptor code, in the bfd
	subdirectory, seems to have additional modes for bsd and
	linux.  Now the "file format" tag, a.out-i386-bsd, from the
	headers above seems to indicate that I am using the i386bsd.c
	code from the bfd library. (This is using i386aout emulation
	mode of ld.) But even though it all looks ok to me, a gnu
	gcc/ld/etc newbie, it still does not work.

	Can anyone shed any light on what I have done wrong?

		Thanks,

		   Scott

	P.S. I am aware of the work summarized by Craig Chase a year
	     ago. I started with the information found in 386bsd on
	     tesla.ee.cornell.edu. But the patches provided there are
	     for gnu-ld version 1.94 beta. And it would seem that there
	     was a *large* set of changes between the 1.9 code that I
	     was able to obtain and 1.94.
-- 
___________________________________________________________________________
Scott Bolte                 scott@craycos.com               +1 719 540 4186
Cray Computer Corporation, 1110 Bayfield Drive, Colorado Springs, CO  80906
	     As anyone here will tell you: I speak for myself.

			*** Celebrate Diversity ***