NetBSD/compat
martin 410920e2de Pull up following revision(s) (requested by chs in ticket #492):
lib/libc/arch/powerpc64/sys/__vfork14.S: revision 1.2
	lib/libc/arch/powerpc64/sys/__syscall.S: revision 1.2
	lib/libc/arch/powerpc/sys/__syscall.S: revision 1.3
	lib/libc/arch/powerpc64/sys/syscall.S: revision 1.2
	lib/libc/arch/powerpc/sys/__clone.S: revision 1.6
	lib/libc/arch/powerpc64/gen/__setjmp14.S: revision 1.3
	sys/arch/powerpc/include/asm.h: revision 1.47
	lib/libc/arch/powerpc64/sys/cerror.S: revision 1.6
	lib/libc/arch/powerpc64/sys/getcontext.S: revision 1.5
	lib/libc/arch/powerpc64/sys/brk.S: revision 1.5
	lib/libc/arch/powerpc64/sys/ptrace.S: revision 1.3
	lib/libc/arch/powerpc64/genassym.cf: revision 1.1
	lib/libc/arch/powerpc64/gen/__sigsetjmp14.S: revision 1.3
	lib/libc/arch/powerpc/sys/getcontext.S: revision 1.6
	compat/powerpc64/powerpc/bsd.powerpc.mk: revision 1.3
	lib/libc/arch/powerpc64/sys/pipe.S: revision 1.2
	lib/libc/arch/powerpc/sys/brk.S: revision 1.14
	lib/libc/arch/powerpc64/SYS.h: revision 1.3
	lib/libc/arch/powerpc64/sys/fork.S: revision 1.2
	lib/libc/arch/powerpc64/sys/__sigtramp2.S: revision 1.4
	lib/libc/arch/powerpc64/Makefile.inc: revision 1.3
	lib/libc/arch/powerpc/sys/pipe.S: revision 1.9
	lib/libc/compiler_rt/Makefile.inc: revision 1.25
	lib/libc/arch/powerpc64/sys/sbrk.S: revision 1.4, 1.5
	lib/libc/arch/powerpc64/sys/__clone.S: revision 1.2
	lib/libc/arch/powerpc/sys/sbrk.S: revision 1.13
	lib/libc/arch/powerpc/SYS.h: revision 1.13
powerpc64 uses the same sources as powerpc and needs the long double as
double-double sources.
-
Spell LdAddr consistently
-
Add LDFLAGS+=-Wl,-m,elf32ppc_nbsd
-
Fix cmpptr/cmpreq/etc to use right mnemonics
-
Minimize differences between powerpc and powerpc64
-
Fix powerpc64 assembly to use right instructions for 64bit CPUs.
-
Use hidden for __curbrk and __minbrk to avoid GOT/TOC relocations.
2015-02-04 22:00:24 +00:00
..
amd64/i386 build compat versions of libgomp for everything except mips N64 (for now.) 2011-09-23 06:44:36 +00:00
arm MKCOMPAT fixes for aarch64 2014-08-10 23:26:25 +00:00
dirshack Implement build_install in src/lib/Makefile, which traverses the 2012-08-17 16:22:27 +00:00
mips64 Define LIBGCC_MACHINE_ARCH so correct files are used o32 libgcc. 2013-02-14 09:22:18 +00:00
powerpc64/powerpc Pull up following revision(s) (requested by chs in ticket #492): 2015-02-04 22:00:24 +00:00
sparc64/sparc build compat versions of libgomp for everything except mips N64 (for now.) 2011-09-23 06:44:36 +00:00
Makefile Implement build_install in src/lib/Makefile, which traverses the 2012-08-17 16:22:27 +00:00
Makefile.compat Revert last, it breaks the tricks xsrc uses. 2012-08-23 21:21:14 +00:00
README Fix typos; wording. 2012-03-29 18:35:11 +00:00
archdirs.mk Fix else if botch 2014-08-11 04:33:30 +00:00
compatsubdir.mk Implement build_install in src/lib/Makefile, which traverses the 2012-08-17 16:22:27 +00:00
m32.mk avoid adding -m32 to various variables multiple times aka, multiple inclusions. 2011-06-18 01:22:34 +00:00

README

$NetBSD: README,v 1.8 2012/03/29 18:35:11 wiz 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
allows 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 $MAKEOBJDIR 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 amd64 port.  In each of these
subdirectories, a small Makefile and makefile fragment should exist.  The
Makefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then
include "../../compatsubdir.mk".  E.g., amd64/i386/Makefile has:

	BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk

	.include "../../compatsubdir.mk"

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 Makefiles around.  amd64/i386/bsd.i386.mk looks like:

	LD+=			-m elf_i386
	MLIBDIR=		i386
	LIBC_MACHINE_ARCH=	${MLIBDIR}
	COMMON_MACHINE_ARCH=	${MLIBDIR}
	KVM_MACHINE_ARCH=	${MLIBDIR}
	PTHREAD_MACHINE_ARCH=	${MLIBDIR}
	BFD_MACHINE_ARCH=	${MLIBDIR}
	CSU_MACHINE_ARCH=	${MLIBDIR}
	CRYPTO_MACHINE_CPU=	${MLIBDIR}
	LDELFSO_MACHINE_CPU=	${MLIBDIR}

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

and the referenced m32.mk looks like:

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

	.include "Makefile.compat"


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

archdirs.mk 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 subdirectories
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.



mrg@eterna.com.au
december 2009