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