Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jul 2010 16:40:43 +0200
From:      Tijl Coosemans <tijl@coosemans.org>
To:        freebsd-amd64@freebsd.org
Subject:   sys/boot includes amd64 headers
Message-ID:  <201007281640.51097.tijl@coosemans.org>

next in thread | raw e-mail | index | archive | help
--nextPart4105206.OkeMhxk1Mv
Content-Type: multipart/mixed;
  boundary="Boundary-01=_rFEUMYCha2Qc4Zt"
Content-Transfer-Encoding: 7bit


--Boundary-01=_rFEUMYCha2Qc4Zt
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

While working on cc -m32 support I added the following to all headers
in sys/amd64/include to make sure none of my changes have an effect on
building world+kernel:

#ifndef __x86_64__
#error bla
#endif

This exposed some problems in sys/boot. The Makefiles there create a
symlink .OBJDIR/machine -> sys/i386/includes and add -I. to the CFLAGS
such that including <machine/header.h> includes the i386 header.

The problem is that <stdarg.h> is also included and is a symlink in
WORLDTMP/usr/include to the machine/stdarg.h there, which is for amd64.
There should be a symlink .OBJDIR/stdarg.h -> machine/stdarg.h to fix
this.

Another case is sys/boot/i386/kgzldr which includes <sys/types.h> and
that in turn includes headers from machine, so it needs the machine
symlink.

Could somebody review the attached patch to make sure it does the right
thing?

--Boundary-01=_rFEUMYCha2Qc4Zt
Content-Type: text/plain;
  charset="us-ascii";
  name="sys.boot-amd64.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="sys.boot-amd64.diff"

diff --git a/sys/boot/ficl/Makefile b/sys/boot/ficl/Makefile
index cdc8f7e..bb9c04c 100644
=2D-- a/sys/boot/ficl/Makefile
+++ b/sys/boot/ficl/Makefile
@@ -57,12 +57,15 @@ softcore.c: ${SOFTWORDS} softcore.awk
 	    | awk -f softcore.awk -v datestamp=3D"`LC_ALL=3DC date`") > ${.TARGET}
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2D${SRCS:M*.c:R:S/$/.o/g}: machine
+${SRCS:M*.c:R:S/$/.o/g}: machine stdarg.h
=20
=2Dbeforedepend ${OBJS}: machine
+beforedepend ${OBJS}: machine stdarg.h
=20
 machine:
 	ln -sf ${.CURDIR}/../../i386/include machine
=20
=2DCLEANFILES+=3D	machine
+stdarg.h:
+	ln -sf machine/stdarg.h stdarg.h
+
+CLEANFILES+=3D	machine stdarg.h
 .endif
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index ab5a69a..4196115 100644
=2D-- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -95,10 +95,12 @@ boot2.h: boot1.out
 	    REL1=3D`printf "%d" ${REL1}` > ${.TARGET}
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2Dbeforedepend boot2.s: machine
=2DCLEANFILES+=3D	machine
+beforedepend boot2.s: machine stdarg.h
+CLEANFILES+=3D	machine stdarg.h
 machine:
 	ln -sf ${.CURDIR}/../../../i386/include machine
+stdarg.h:
+	ln -sf machine/stdarg.h stdarg.h
 .endif
=20
 .include <bsd.prog.mk>
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
index cc71b35..4532035 100644
=2D-- a/sys/boot/i386/gptboot/Makefile
+++ b/sys/boot/i386/gptboot/Makefile
@@ -68,10 +68,12 @@ gptboot.out: ${BTXCRT} gptboot.o sio.o
 gptboot.o: ${.CURDIR}/../../common/ufsread.c
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2Dbeforedepend gptboot.o: machine
=2DCLEANFILES+=3D	machine
+beforedepend gptboot.o: machine stdarg.h
+CLEANFILES+=3D	machine stdarg.h
 machine:
 	ln -sf ${.CURDIR}/../../../i386/include machine
+stdarg.h:
+	ln -sf machine/stdarg.h stdarg.h
 .endif
=20
 .include <bsd.prog.mk>
diff --git a/sys/boot/i386/kgzldr/Makefile b/sys/boot/i386/kgzldr/Makefile
index a124474..54e8482 100644
=2D-- a/sys/boot/i386/kgzldr/Makefile
+++ b/sys/boot/i386/kgzldr/Makefile
@@ -7,7 +7,7 @@ BINDIR=3D	${LIBDIR}
 NO_MAN=3D
=20
 SRCS=3D	start.s boot.c inflate.c lib.c crt.s sio.s
=2DCFLAGS=3D	-Os
+CFLAGS=3D	-Os -I.
 CFLAGS+=3D-DKZIP
 NO_SHARED=3D
 LDFLAGS=3D-Wl,-r
@@ -16,4 +16,11 @@ LDFLAGS=3D-Wl,-r
 BOOT_COMCONSOLE_PORT?=3D	0x3f8
 AFLAGS+=3D--defsym SIO_PRT=3D${BOOT_COMCONSOLE_PORT}
=20
+.if ${MACHINE_ARCH} =3D=3D "amd64"
+beforedepend boot.o lib.o: machine
+CLEANFILES+=3D	machine
+machine:
+	ln -sf ${.CURDIR}/../../../i386/include machine
+.endif
+
 .include <bsd.prog.mk>
diff --git a/sys/boot/i386/libfirewire/Makefile b/sys/boot/i386/libfirewire=
/Makefile
index 28f7630..785d282 100644
=2D-- a/sys/boot/i386/libfirewire/Makefile
+++ b/sys/boot/i386/libfirewire/Makefile
@@ -17,14 +17,16 @@ CFLAGS+=3D	-I${.CURDIR}/../libi386
 CFLAGS+=3D	-Wformat -Wall
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2DCLEANFILES+=3D    machine
+CLEANFILES+=3D    machine stdarg.h
 machine:
 	ln -sf ${.CURDIR}/../../../i386/include machine
+stdarg.h:
+	ln -sf machine/stdarg.h stdarg.h
 .endif
=20
 .include <bsd.lib.mk>
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2Dbeforedepend ${OBJS}: machine
+beforedepend ${OBJS}: machine stdarg.h
 .endif
=20
diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
index f1a461a..b43cec7 100644
=2D-- a/sys/boot/i386/libi386/Makefile
+++ b/sys/boot/i386/libi386/Makefile
@@ -54,13 +54,15 @@ CFLAGS+=3D	-I${.CURDIR}/../../common -I${.CURDIR}/../bt=
x/lib \
 CFLAGS+=3D	-I${.CURDIR}/../../../../lib/libstand/
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2DCLEANFILES+=3D	machine
+CLEANFILES+=3D	machine stdarg.h
 machine:
 	ln -sf ${.CURDIR}/../../../i386/include machine
+stdarg.h:
+	ln -sf machine/stdarg.h stdarg.h
 .endif
=20
 .include <bsd.lib.mk>
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2Dbeforedepend ${OBJS}: machine
+beforedepend ${OBJS}: machine stdarg.h
 .endif
diff --git a/sys/boot/zfs/Makefile b/sys/boot/zfs/Makefile
index b48804b..31794c7 100644
=2D-- a/sys/boot/zfs/Makefile
+++ b/sys/boot/zfs/Makefile
@@ -27,13 +27,15 @@ CFLAGS+=3D	-m32 -march=3Di386
 CFLAGS+=3D	-Wformat -Wall
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2DCLEANFILES+=3D    machine
+CLEANFILES+=3D    machine stdarg.h
 machine:
 	ln -sf ${.CURDIR}/../../i386/include machine
+stdarg.h:
+	ln -sf machine/stdarg.h stdarg.h
 .endif
=20
 .include <bsd.lib.mk>
=20
 .if ${MACHINE_ARCH} =3D=3D "amd64"
=2Dbeforedepend ${OBJS}: machine
+beforedepend ${OBJS}: machine stdarg.h
 .endif

--Boundary-01=_rFEUMYCha2Qc4Zt--

--nextPart4105206.OkeMhxk1Mv
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (FreeBSD)

iF4EABEIAAYFAkxQQXIACgkQfoCS2CCgtit2LQD/T8mJS1KTX17Jhaa8W/+jehnQ
8MwXYqo3IVKD+R73QzEA/1xE+Vum3av5++pC6YaN/njiI6/n5oZxdj/taGCeMiWD
=xI1F
-----END PGP SIGNATURE-----

--nextPart4105206.OkeMhxk1Mv--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007281640.51097.tijl>