Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: matt_nb5_mips64
Pull request Compare This branch is 2686 commits ahead, 62651 commits behind trunk.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


$NetBSD: README,v 2009/12/14 06:20:58 mrg Exp $

Building multi- ABI libraries for NetBSD platforms.

src/compat has a framework to (re)build the libraries shipped with
NetBSD for a different ABI than the default for that platform.  This
allow 32-bit libraries for the amd64 and sparc64 ports, and enables
the mips64 port to support all three of old-style 32-bit ("o32"), the
new 32-bit (default, "n32", 64-bit CPU required) or the 64-bit ABI.

The basic premise is to re-set $MAKEOBJDIRPREFIX to fresh subdirectory
underneath src/compat and rebuild the libraries with a different set
of options.  Each platform wanting support should create their port
subdirectory directly in src/compat, and then one subdirectory in here
for each ABI required.  e.g., src/compat/amd64/i386 is where we build
the 32-bit compat libraries for the amd64port.  In each of these
subdirs, a small Makefile and makefile fragment should exist.  The
Makefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then
include "../../Makefile.common".  Eg, amd64/i386/Makefile has:

	#	$NetBSD: README,v 2009/12/14 06:20:58 mrg Exp $


	.include "../../Makefile.common"

In the makefile fragment any changes to ABI flags are passed here
and the MLIBDIR variable must be set to the subdirectory in /usr/lib
where libraries for the ABI will be installed.  There are a couple of
helper Makefile's around.  amd64/i386/ looks like:

	#	$NetBSD: README,v 2009/12/14 06:20:58 mrg Exp $

	LD+=		-m elf_i386
	MLIBDIR=	i386

	.include "${NETBSDSRCDIR}/compat/Makefile.m32"

and the referenced Makefile.m32 looks like:

	#	$NetBSD: README,v 2009/12/14 06:20:58 mrg Exp $

	# Makefile fragment to help implement a set of 'cc -m32' libraries.

	COPTS+=			-m32
	CPUFLAGS+=		-m32
	LDADD+=			-m32
	LDFLAGS+=		-m32

	.include "Makefile.compat"

Makefile.common holds the list of subdirectories (the libraries and
ld.elf_so) to build with this ABI.

Makefile.md_subdir holds the list of subdirectories for each port.

Makefile.compat has the basic framework to force the right paths for
library and ld.elf_so linkage.  It contains a hack to create subdirs
in the build that should be fixed.

dirshack/Makefile is a hack to get objdirs created timely, and should
be fixed in a better way.


- fix MLIBDIR in ld.elf_so arch-subdirs to be generic since it now is:
  .if defined(MLIBDIR)
- check this part in ld.elf_so Makefile.  it may be right now:
  # XXXX this needs to find the right one some how yet.
  CLIBOBJ!=     cd ${NETBSDSRCDIR}/lib/libc && ${PRINTOBJDIR}
december 2009
Something went wrong with that request. Please try again.