Subject: re: Elf on SPARC?
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Eduardo E. Horvath <>
List: tech-userlevel
Date: 11/06/1997 08:27:31
On Wed, 5 Nov 1997, Jonathan Stone wrote:

> >Has anyone considered what's involved in emulating a NetBSD environment on
> >NetBSD.  Or rather, a different NetBSD environment on NetBSD.  I want to
> >switch to an SPARC elf64 format but still be able to run SPARC a.out
> >executables.
> Are you sure you mean elf64 and not elf32?  Does the sparc pmap
> support 64-bit address spaces? If it doesn't, you probably want elf32,
> or weird things will happen when you try and access memory via
> pointers with the high 32 bits set.  (64-bit ints and 32-bit pointers
> would work better, but it may be hard to set up a toolchain for.)

At the moment I'm just interested in 32-bit ABI compliant programs in the
elf64 object file format.  GCC is not capable of generating SPARC v9
executables without a major overhaul.

> Either way, there's not that much to change in the kernel. Add
> 	options 	EXEC_ELF32
> in the std.sparc file, rerun config and recompile.

> You'll need to configure a current GNU binutils to make an sparc Elf
> toolchain, and you'll probably need to reconfigure gcc to emit the
> appropriate assembler pseudo-ops for ELF. And you'll need an elf
>; perhaps it's easiest to start with statically-linked binaries.

I have EXEC_ELF32 and EXEC_ELF64 in the kernel already (I think).  To a 
certain extent it's the standard cross-compilation problem, but with a
funny twist.  The quiestions I have are:

	How does an a.out32 userland live with an elf64 userland?

	Is there a need for an `/emul/NetBSD-elf64' or such tree?

	If there is one toolchain for a.out32 and another for elf64, and
	build process generates executables to generate source files to
	generate object files, how do you run the correct toolchain for
	the appropriate phase of the build?

	What needs to be re-written?  There's libkvm, gdb, as, and ld that
	need to be done to get off the ground.  ldd, gcc, and nm can come
	later, I think.  What else?

Oh, yeah, and my favorite:

	Can libkvm be built to handle both a.out and elf formats?
	Especially since by convention a.out prepends underscores in front
	of labels and elf doesn't?

Eduardo Horvath
"Cliffs are for climbing.  That's why God invented grappling hooks."
					- Benton Frasier