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