From 7a73957e4345e7b66e24f16c6a44a598041be430 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 30 Mar 2004 22:57:11 +0000 Subject: Add a snapshot of build32.sh for amd64 systems. The readme and comments describe the (severe) restrictions and future plans. --- tools/lib32/README | 15 +++++++++++++++ tools/lib32/build32.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tools/lib32/README create mode 100644 tools/lib32/build32.sh (limited to 'tools/lib32') diff --git a/tools/lib32/README b/tools/lib32/README new file mode 100644 index 0000000..d430cc2 --- /dev/null +++ b/tools/lib32/README @@ -0,0 +1,15 @@ +# $FreeBSD$ + +This script is a stopgap for building tuned 32 bit (but i386 ABI compatable) +libraries for amd64 systems. We *know* we have things like CMOV, SSE2 etc +so take advantage of it. + +At some point libc would be configured to use the fast syscall/sysret +instructions (instead of int 0x80) since we have a known minimum feature +set and don't have to do runtime tests for it. + +libpthread could use the amd64 sysarch syscalls for setting %fs/%gs +since we don't have USER_LDT. This would be a heck of a lot easier than +trying to run a real i386-built libc/libpthread. + +Again, this hack is a stopgap until something is integrated into world. diff --git a/tools/lib32/build32.sh b/tools/lib32/build32.sh new file mode 100644 index 0000000..f6eed16 --- /dev/null +++ b/tools/lib32/build32.sh @@ -0,0 +1,51 @@ +#! /bin/sh +# $FreeBSD$ +# +# This script is for running on a self-hosted amd64 machine, with an up-to-date +# world and toolchain etc. ie: the installed world is assumed to match the sources. +# It is rude, crude and brutal. But its the only option for now. +# +# Its purpose is to build a 32 bit library set and a ld-elf32.so.1. + +# XXX beware.. some of the library targets have no way to disable +# XXX installation of includes. ie: it will re-install some files in +# XXX /usr/include for you. + +mkdir /lib32 +mkdir /usr/lib32 +mkdir /usr/local/lib32 +mkdir /usr/X11R6/lib32 + +# Set up an obj tree +chflags -R noschg /tmp/i386 +rm -rf /tmp/i386 + +CCARGS="-m32 -march=athlon-xp -msse2 -mfancy-math-387 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32" +CXXARGS="-m32 -march=athlon-xp -msse2 -mfancy-math-387 -I/tmp/i386/root/usr/include/c++/3.3 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32" + +# and a place to put the alternate include tree into. +mkdir -p /tmp/i386/root +make -s MAKEOBJDIRPREFIX=/tmp/i386 DESTDIR=/tmp/i386/root MACHINE_ARCH=i386 hierarchy + +# Now build includes +make -s MAKEOBJDIRPREFIX=/tmp/i386 DESTDIR=/tmp/i386/root MACHINE_ARCH=i386 obj +make -s MAKEOBJDIRPREFIX=/tmp/i386 DESTDIR=/tmp/i386/root MACHINE_ARCH=i386 includes + +# libncurses needs a build-tools pass first. I wish build-tools was a recursive target. +(cd lib/libncurses; make -s MAKEOBJDIRPREFIX=/tmp/i386 build-tools) + +# Now the libraries. This doesn't work for gnuregex yet. hence -k. +# libbind is just an internal target, ignore it. +make -s -DNO_BIND -DNOMAN -DNODOC -DNOINFO MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc $CCARGS" CXX="c++ $CXXARGS" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" -k libraries + +# Hack to fix gnuregex which does hacks to the -I path based on $DESTDIR. But, we cannot +# use DESTDIR during the libraries target, because we're just using alternate includes, not +# an alternate install directory. +(cd gnu/lib/libregex; make -s -DNOMAN -DNODOC -DNOINFO MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -I/tmp/i386/root/usr/include/gnu $CCARGS" CXX="c++ $CXXARGS" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" all install) + +# and now that we have enough libraries, build ld-elf32.so.1 +cd libexec/rtld-elf +make -s -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc $CCARGS -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" obj +make -s -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc $CCARGS -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" depend +make -s -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc $CCARGS -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" +make -s -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc $CCARGS -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" install -- cgit v1.1