Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply patch (requested by mrg in ticket #1499):
src/compat version 2. this allows building any number of alternate library / program target ABIs. rather than duplicating the list of subdirs and Makefiles to build, it re-traverses the necessary ones. details: - add support for MAKEDIRTARGETENV to share/mk - renames LD32DIR to MLIBDIR - fixes library builds for some subdirs (more was built than needed) - fixes /bin & /sbin apps in compat mode - reduces complexity in src/compat and the rest of the tree - updates ldd netbsd32 support
- Loading branch information
riz
committed
Jan 6, 2011
1 parent
13fe76a
commit 65af359
Showing
198 changed files
with
593 additions
and
5,540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,17 @@ | ||
# $NetBSD: Makefile,v 1.1 2008/10/26 07:38:27 mrg Exp $ | ||
# $NetBSD: Makefile,v 1.1.2.1 2011/01/06 05:19:55 riz Exp $ | ||
|
||
# Build 32-bit compat versions of: | ||
# src/gnu/lib/libgcc4 into ${DESTDIR}/usr/lib/<32arch> | ||
# src/lib/libc into ${DESTDIR}/usr/lib/<32arch> | ||
# src/gnu/lib/ into ${DESTDIR}/usr/lib/<32arch> | ||
# src/lib/ into ${DESTDIR}/usr/lib/<32arch> | ||
# src/libexec/ld.elf_so into ${DESTDIR}/usr/libexec/ld.elf_so-<32arch> | ||
# Build multi-abi libaries | ||
|
||
.include <bsd.own.mk> | ||
|
||
.if ${MKCOMPAT} != "no" && \ | ||
(${MACHINE} == "sparc64" || ${MACHINE} == "amd64") | ||
|
||
.if ${MKCOMPAT} != "no" | ||
.if !make(includes) | ||
SUBDIR= gnu/lib/crtstuff4 .WAIT \ | ||
lib/csu .WAIT \ | ||
gnu/lib/libgcc4 .WAIT \ | ||
lib/libc .WAIT \ | ||
lib/libutil .WAIT \ | ||
lib gnu/lib .WAIT \ | ||
libexec/ld.elf_so | ||
.endif | ||
|
||
.include "archdirs.mk" | ||
|
||
SUBDIR= dirshack .WAIT ${ARCHDIR_SUBDIR} | ||
|
||
.endif | ||
.endif | ||
|
||
.include <bsd.subdir.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,72 @@ | ||
$NetBSD: README,v 1.2 2008/10/27 07:22:22 mrg Exp $ | ||
$NetBSD: README,v 1.2.2.1 2011/01/06 05:19:55 riz Exp $ | ||
|
||
This directory contains Makefile fragments that will build all of the | ||
NetBSD libraries in 32-bit mode and install them into /usr/lib/<arch> | ||
and also install a /usr/libexec/ld.elf_so-<arch>. | ||
|
||
This is current only supported for the amd64 and sparc64 platforms, | ||
where <arch> is "i386" or "sparc" respectively. (It could be used to | ||
build MIPS o32 libraries on n32 system, but not both n32 and o32 on | ||
a n64 system. It only supports one extra target.) | ||
Building multi- ABI libraries for NetBSD platforms. | ||
|
||
|
||
Most of the makefiles here were built with the "build-makefiles" script. | ||
The expections are lib/csu/Makefile and ld.elf_so/Makefile. | ||
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 method used is the: | ||
- evaluate some local variables | ||
- switch .CURDIR | ||
- include original Makefile, | ||
- evaluate some variables | ||
- switch .CURDIR back | ||
that is used by crunchgen to build eg, installer media or /rescue. | ||
The basic premise is to re-set $MAKEOBJDIRPREFIX 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 | ||
subdirs, 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" Eg, amd64/i386/Makefile has: | ||
|
||
BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk | ||
|
||
.include "../../compatsubdir.mk" | ||
|
||
TODO: | ||
- some yacc issue -- libc, libipsec and libpcap need "make" run | ||
to generate headers properly, otherwise it complains about | ||
no way to get to foo.h. this is currently hacked by putting | ||
a rule "foo.h: foo.c" in the (generated) makefiles | ||
- there's an ugly hack to make libpam build correctly again the | ||
right libc. ld.elf_so has a similar (but less ugly hack) | ||
- not sure that /usr/lib/{i386,sparc}{,/i18n} are created | ||
properly yet | ||
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: | ||
|
||
Future work | ||
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} | ||
|
||
Ideally this should be able to handle any number of compat targets. | ||
Perhaps using a "force MAKEOBJDIR, and run-run make" solution will | ||
work, but my initial attempts got me no where. If not, perhaps | ||
build-makefiles could be expanded to be used at run-time in such | ||
a per-compat target obj-dir. | ||
.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 subdirs | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# $NetBSD: Makefile,v 1.1.4.2 2011/01/06 05:19:55 riz Exp $ | ||
|
||
BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk | ||
|
||
.include "../../compatsubdir.mk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# $NetBSD: bsd.i386.mk,v 1.2.2.2 2011/01/06 05:19:55 riz Exp $ | ||
|
||
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 "${.PARSEDIR}/../../m32.mk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# $NetBSD: archdirs.mk,v 1.1.2.2 2011/01/06 05:19:55 riz Exp $ | ||
|
||
# list of subdirs used per-platform | ||
|
||
.if ${MACHINE} == "sparc64" | ||
ARCHDIR_SUBDIR= sparc64/sparc | ||
.endif | ||
|
||
.if ${MACHINE} == "amd64" | ||
ARCHDIR_SUBDIR= amd64/i386 | ||
.endif | ||
# $NetBSD: archdirs.mk,v 1.1.2.2 2011/01/06 05:19:55 riz Exp $ | ||
|
||
# list of subdirs used per-platform | ||
|
||
.if ${MACHINE} == "sparc64" | ||
ARCHDIR_SUBDIR= sparc64/sparc | ||
.endif | ||
|
||
.if ${MACHINE} == "amd64" | ||
ARCHDIR_SUBDIR= amd64/i386 | ||
.endif |
Oops, something went wrong.