1146515Sru$NetBSD: README,v 1.6 2010/06/30 03:28:01 mrg Exp $ 2146515Sru 3146515Sru 4146515SruBuilding multi- ABI libraries for NetBSD platforms. 5146515Sru 6146515Sru 7146515Srusrc/compat has a framework to (re)build the libraries shipped with 8146515SruNetBSD for a different ABI than the default for that platform. This 9146515Sruallows 32-bit libraries for the amd64 and sparc64 ports, and enables 10146515Sruthe mips64 port to support all three of old-style 32-bit ("o32"), the 11146515Srunew 32-bit (default, "n32", 64-bit CPU required) or the 64-bit ABI. 12146515Sru 13146515Sru 14146515SruThe basic premise is to re-set $MAKEOBJDIR to fresh subdirectory 15146515Sruunderneath src/compat and rebuild the libraries with a different set 16146515Sruof options. Each platform wanting support should create their port 17146515Srusubdirectory directly in src/compat, and then one subdirectory in here 18146515Srufor each ABI required. e.g., src/compat/amd64/i386 is where we build 19146515Sruthe 32-bit compat libraries for the amd64 port. In each of these 20146515Srusubdirs, a small Makefile and makefile fragment should exist. The 21146515SruMakefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then 22146515Sruinclude "../../compatsubdir.mk" Eg, amd64/i386/Makefile has: 23146515Sru 24146515Sru BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk 25146515Sru 26146515Sru .include "../../compatsubdir.mk" 27146515Sru 28146515SruIn the makefile fragment any changes to ABI flags are passed here 29146515Sruand the MLIBDIR variable must be set to the subdirectory in /usr/lib 30146515Sruwhere libraries for the ABI will be installed. There are a couple of 31146515Sruhelper Makefiles around. amd64/i386/bsd.i386.mk looks like: 32146515Sru 33146515Sru LD+= -m elf_i386 34146515Sru MLIBDIR= i386 35146515Sru LIBC_MACHINE_ARCH= ${MLIBDIR} 36146515Sru COMMON_MACHINE_ARCH= ${MLIBDIR} 37146515Sru KVM_MACHINE_ARCH= ${MLIBDIR} 38146515Sru PTHREAD_MACHINE_ARCH= ${MLIBDIR} 39146515Sru BFD_MACHINE_ARCH= ${MLIBDIR} 40146515Sru CSU_MACHINE_ARCH= ${MLIBDIR} 41146515Sru CRYPTO_MACHINE_CPU= ${MLIBDIR} 42146515Sru LDELFSO_MACHINE_CPU= ${MLIBDIR} 43146515Sru 44146515Sru .include "${NETBSDSRCDIR}/compat/m32.mk" 45 46and the referenced m32.mk looks like: 47 48 COPTS+= -m32 49 CPUFLAGS+= -m32 50 LDADD+= -m32 51 LDFLAGS+= -m32 52 MKDEPFLAGS+= -m32 53 54 .include "Makefile.compat" 55 56 57compatsubdir.mk holds the list of subdirectories (the libraries and 58ld.elf_so) to build with this ABI. 59 60archdirs.mk holds the list of subdirectories for each port. 61 62Makefile.compat has the basic framework to force the right paths for 63library and ld.elf_so linkage. It contains a hack to create subdirs 64in the build that should be fixed. 65 66dirshack/Makefile is a hack to get objdirs created timely, and should 67be fixed in a better way. 68 69 70 71mrg@eterna.com.au 72december 2009 73