Home | History | Annotate | Line # | Download | only in compat
README revision 1.2.2.1
      1  1.2.2.1  riz $NetBSD: README,v 1.2.2.1 2011/01/06 05:19:55 riz Exp $
      2      1.1  mrg 
      3      1.1  mrg 
      4  1.2.2.1  riz Building multi- ABI libraries for NetBSD platforms.
      5      1.1  mrg 
      6      1.1  mrg 
      7  1.2.2.1  riz src/compat has a framework to (re)build the libraries shipped with
      8  1.2.2.1  riz NetBSD for a different ABI than the default for that platform.  This
      9  1.2.2.1  riz allows 32-bit libraries for the amd64 and sparc64 ports, and enables
     10  1.2.2.1  riz the mips64 port to support all three of old-style 32-bit ("o32"), the
     11  1.2.2.1  riz new 32-bit (default, "n32", 64-bit CPU required) or the 64-bit ABI.
     12      1.1  mrg 
     13      1.1  mrg 
     14  1.2.2.1  riz The basic premise is to re-set $MAKEOBJDIRPREFIX to fresh subdirectory
     15  1.2.2.1  riz underneath src/compat and rebuild the libraries with a different set
     16  1.2.2.1  riz of options.  Each platform wanting support should create their port
     17  1.2.2.1  riz subdirectory directly in src/compat, and then one subdirectory in here
     18  1.2.2.1  riz for each ABI required.  e.g., src/compat/amd64/i386 is where we build
     19  1.2.2.1  riz the 32-bit compat libraries for the amd64 port.  In each of these
     20  1.2.2.1  riz subdirs, a small Makefile and makefile fragment should exist.  The
     21  1.2.2.1  riz Makefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then
     22  1.2.2.1  riz include "../../compatsubdir.mk"  Eg, amd64/i386/Makefile has:
     23      1.1  mrg 
     24  1.2.2.1  riz 	BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk
     25      1.1  mrg 
     26  1.2.2.1  riz 	.include "../../compatsubdir.mk"
     27      1.1  mrg 
     28  1.2.2.1  riz In the makefile fragment any changes to ABI flags are passed here
     29  1.2.2.1  riz and the MLIBDIR variable must be set to the subdirectory in /usr/lib
     30  1.2.2.1  riz where libraries for the ABI will be installed.  There are a couple of
     31  1.2.2.1  riz helper Makefiles around.  amd64/i386/bsd.i386.mk looks like:
     32      1.1  mrg 
     33  1.2.2.1  riz 	LD+=			-m elf_i386
     34  1.2.2.1  riz 	MLIBDIR=		i386
     35  1.2.2.1  riz 	LIBC_MACHINE_ARCH=	${MLIBDIR}
     36  1.2.2.1  riz 	COMMON_MACHINE_ARCH=	${MLIBDIR}
     37  1.2.2.1  riz 	KVM_MACHINE_ARCH=	${MLIBDIR}
     38  1.2.2.1  riz 	PTHREAD_MACHINE_ARCH=	${MLIBDIR}
     39  1.2.2.1  riz 	BFD_MACHINE_ARCH=	${MLIBDIR}
     40  1.2.2.1  riz 	CSU_MACHINE_ARCH=	${MLIBDIR}
     41  1.2.2.1  riz 	CRYPTO_MACHINE_CPU=	${MLIBDIR}
     42  1.2.2.1  riz 	LDELFSO_MACHINE_CPU=	${MLIBDIR}
     43      1.1  mrg 
     44  1.2.2.1  riz 	.include "${NETBSDSRCDIR}/compat/m32.mk"
     45  1.2.2.1  riz 
     46  1.2.2.1  riz and the referenced m32.mk looks like:
     47  1.2.2.1  riz 
     48  1.2.2.1  riz 	COPTS+=			-m32
     49  1.2.2.1  riz 	CPUFLAGS+=		-m32
     50  1.2.2.1  riz 	LDADD+=			-m32
     51  1.2.2.1  riz 	LDFLAGS+=		-m32
     52  1.2.2.1  riz 	MKDEPFLAGS+=		-m32
     53  1.2.2.1  riz 
     54  1.2.2.1  riz 	.include "Makefile.compat"
     55  1.2.2.1  riz 
     56  1.2.2.1  riz 
     57  1.2.2.1  riz compatsubdir.mk holds the list of subdirectories (the libraries and
     58  1.2.2.1  riz ld.elf_so) to build with this ABI.
     59  1.2.2.1  riz 
     60  1.2.2.1  riz archdirs.mk holds the list of subdirectories for each port.
     61  1.2.2.1  riz 
     62  1.2.2.1  riz Makefile.compat has the basic framework to force the right paths for
     63  1.2.2.1  riz library and ld.elf_so linkage.  It contains a hack to create subdirs
     64  1.2.2.1  riz in the build that should be fixed.
     65  1.2.2.1  riz 
     66  1.2.2.1  riz dirshack/Makefile is a hack to get objdirs created timely, and should
     67  1.2.2.1  riz be fixed in a better way.
     68  1.2.2.1  riz 
     69  1.2.2.1  riz 
     70  1.2.2.1  riz 
     71  1.2.2.1  riz mrg (a] eterna.com.au
     72  1.2.2.1  riz december 2009
     73