From b956c8735e9e9e8c6ff830c192fc71c3dbb2571f Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Sat, 9 Jul 2011 15:04:42 +0200 Subject: [PATCH] Fix GCC image building --- drivers/Makefile.inc | 4 ++-- drivers/acpi/Makefile | 2 +- drivers/ahci/Makefile | 2 +- drivers/amddev/Makefile | 2 +- drivers/at_wini/Makefile | 2 +- drivers/atl2/Makefile | 2 +- drivers/bios_wini/Makefile | 2 +- drivers/dec21140A/Makefile | 2 +- drivers/dp8390/Makefile | 2 +- drivers/dpeth/Makefile | 2 +- drivers/e1000/Makefile | 2 +- drivers/filter/Makefile | 2 +- drivers/floppy/Makefile | 2 +- drivers/fxp/Makefile | 2 +- drivers/hello/Makefile | 2 +- drivers/lance/Makefile | 2 +- drivers/orinoco/Makefile | 2 +- drivers/pci/Makefile | 2 +- drivers/printer/Makefile | 2 +- drivers/ramdisk/Makefile | 2 +- drivers/random/Makefile | 2 +- drivers/readclock/Makefile | 2 +- drivers/rtl8139/Makefile | 2 +- drivers/rtl8169/Makefile | 2 +- drivers/ti1225/Makefile | 2 +- kernel/Makefile | 15 +++------------ nbsd_include/stdlib.h | 2 ++ servers/Makefile.inc | 2 +- servers/devman/Makefile | 2 +- servers/ext2/Makefile | 2 +- servers/hgfs/Makefile | 2 +- servers/inet/Makefile | 2 +- servers/init/Makefile | 8 +++++++- servers/ipc/Makefile | 2 +- servers/is/Makefile | 2 +- servers/iso9660fs/Makefile | 2 +- servers/lwip/Makefile | 2 +- servers/procfs/Makefile | 2 +- share/mk/Makefile | 2 +- share/mk/bsd.prog.mk | 6 ------ share/mk/minix.bootprog.mk | 2 +- share/mk/minix.service.mk | 14 ++++++++++++++ 42 files changed, 64 insertions(+), 57 deletions(-) create mode 100644 share/mk/minix.service.mk diff --git a/drivers/Makefile.inc b/drivers/Makefile.inc index 4d5669aca..5862b1bca 100644 --- a/drivers/Makefile.inc +++ b/drivers/Makefile.inc @@ -1,7 +1,7 @@ -.if (${NBSD_LIBC} != "no") +.if ${COMPILER_TYPE} == "gnu" CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE LDADD+= -lminlib -lcompat_minix -DEPEND+= ${LIBMINLIB} ${LIBCOMPAT_MINIX} +DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX} .else CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE .endif diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index b0b4dbc41..c05037485 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -149,6 +149,6 @@ MAN= BINDIR?= /usr/sbin -.include +.include .endif diff --git a/drivers/ahci/Makefile b/drivers/ahci/Makefile index 2067d53f8..cf9c84016 100644 --- a/drivers/ahci/Makefile +++ b/drivers/ahci/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /sbin -.include +.include diff --git a/drivers/amddev/Makefile b/drivers/amddev/Makefile index 437140528..731336a9b 100644 --- a/drivers/amddev/Makefile +++ b/drivers/amddev/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/at_wini/Makefile b/drivers/at_wini/Makefile index 88aa5540d..25aece4c6 100644 --- a/drivers/at_wini/Makefile +++ b/drivers/at_wini/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /sbin -.include +.include diff --git a/drivers/atl2/Makefile b/drivers/atl2/Makefile index 46ce34a40..31d5a382d 100644 --- a/drivers/atl2/Makefile +++ b/drivers/atl2/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/bios_wini/Makefile b/drivers/bios_wini/Makefile index 35f1b01de..cb0f177ff 100644 --- a/drivers/bios_wini/Makefile +++ b/drivers/bios_wini/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /sbin -.include +.include diff --git a/drivers/dec21140A/Makefile b/drivers/dec21140A/Makefile index 09bdba94c..42051f8ad 100644 --- a/drivers/dec21140A/Makefile +++ b/drivers/dec21140A/Makefile @@ -14,4 +14,4 @@ BINDIR?= /usr/sbin debug= 0 CPPFLAGS+= -Ddebug=${debug} -w -.include +.include diff --git a/drivers/dp8390/Makefile b/drivers/dp8390/Makefile index 2cbd1fedf..81be544de 100644 --- a/drivers/dp8390/Makefile +++ b/drivers/dp8390/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/dpeth/Makefile b/drivers/dpeth/Makefile index b82759d9e..fe1c3127f 100644 --- a/drivers/dpeth/Makefile +++ b/drivers/dpeth/Makefile @@ -14,4 +14,4 @@ BINDIR?= /usr/sbin debug= 0 CPPFLAGS+= -Ddebug=$(debug) -.include +.include diff --git a/drivers/e1000/Makefile b/drivers/e1000/Makefile index 4a035d10d..91c8b43a8 100644 --- a/drivers/e1000/Makefile +++ b/drivers/e1000/Makefile @@ -11,4 +11,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/filter/Makefile b/drivers/filter/Makefile index b9313be20..119372f57 100644 --- a/drivers/filter/Makefile +++ b/drivers/filter/Makefile @@ -11,4 +11,4 @@ BINDIR?= /usr/sbin CPPFLAGS+= -DDEBUG=1 -DDEBUG2=0 -.include +.include diff --git a/drivers/floppy/Makefile b/drivers/floppy/Makefile index 06f2baa27..62864941e 100644 --- a/drivers/floppy/Makefile +++ b/drivers/floppy/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /sbin -.include +.include diff --git a/drivers/fxp/Makefile b/drivers/fxp/Makefile index c91f1c51b..baa7dca9f 100644 --- a/drivers/fxp/Makefile +++ b/drivers/fxp/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/hello/Makefile b/drivers/hello/Makefile index 52d4764fe..c48a7c454 100644 --- a/drivers/hello/Makefile +++ b/drivers/hello/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/lance/Makefile b/drivers/lance/Makefile index d09f8726c..edadb8d5e 100644 --- a/drivers/lance/Makefile +++ b/drivers/lance/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/orinoco/Makefile b/drivers/orinoco/Makefile index 4393ea20d..db715102c 100644 --- a/drivers/orinoco/Makefile +++ b/drivers/orinoco/Makefile @@ -11,4 +11,4 @@ BINDIR?= /usr/sbin CPPFLAGS.orinoco.c+= -I${MINIXSRCDIR} -.include +.include diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index c2632070c..2616cb20c 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/printer/Makefile b/drivers/printer/Makefile index 7b2c188c4..762664a5d 100644 --- a/drivers/printer/Makefile +++ b/drivers/printer/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/drivers/ramdisk/Makefile b/drivers/ramdisk/Makefile index 9f576cb36..cab36c948 100644 --- a/drivers/ramdisk/Makefile +++ b/drivers/ramdisk/Makefile @@ -159,4 +159,4 @@ elfstrip: $(PROGRAMS) strip $(PROGRAMS) .endif -.include +.include diff --git a/drivers/random/Makefile b/drivers/random/Makefile index d67b6d6c2..2e465979f 100644 --- a/drivers/random/Makefile +++ b/drivers/random/Makefile @@ -13,5 +13,5 @@ BINDIR?= /usr/sbin CPPFLAGS.random.c+= -I${MINIXSRCDIR} -.include +.include diff --git a/drivers/readclock/Makefile b/drivers/readclock/Makefile index 9a8c817f8..a37a4fed2 100644 --- a/drivers/readclock/Makefile +++ b/drivers/readclock/Makefile @@ -11,4 +11,4 @@ BINDIR?= /sbin CPPFLAGS+= -D_SYSTEM=1 -.include +.include diff --git a/drivers/rtl8139/Makefile b/drivers/rtl8139/Makefile index 3a5a6a34d..51f54f33e 100644 --- a/drivers/rtl8139/Makefile +++ b/drivers/rtl8139/Makefile @@ -11,4 +11,4 @@ BINDIR?= /usr/sbin CPPFLAGS+= -I${MINIXSRCDIR} -.include +.include diff --git a/drivers/rtl8169/Makefile b/drivers/rtl8169/Makefile index 25b01ff25..ab4516ff1 100644 --- a/drivers/rtl8169/Makefile +++ b/drivers/rtl8169/Makefile @@ -11,4 +11,4 @@ BINDIR?= /usr/sbin CPPFLAGS+= -I${MINIXSRCDIR} -.include +.include diff --git a/drivers/ti1225/Makefile b/drivers/ti1225/Makefile index 55a57a621..b2310f335 100644 --- a/drivers/ti1225/Makefile +++ b/drivers/ti1225/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/kernel/Makefile b/kernel/Makefile index a431e6633..9ad077a88 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -22,26 +22,17 @@ CFLAGS += -D__kernel__ LDFLAGS+= -.o .elif ${COMPILER_TYPE} == "gnu" CFLAGS+=-march=i386 -CPPFLAGS+= -ffreestanding -fno-stack-protector +CPPFLAGS+= -ffreestanding -fno-stack-protector -D_NETBSD_SOURCE LDFLAGS+= -T ${.CURDIR}/arch/${ARCH}/kernel.lds LDFLAGS+= -nostdlib -L${LIBDIR} -.endif - -.if (${NBSD_LIBC} != "no") LDADD+= -lminlib DPADD+= ${LIBMINLIB} -CPPFLAGS+= -D_NETBSD_SOURCE -.else - .if ${CC} == "gcc" -DPADD+= ${LIBC} -LDADD+= -lgcc -lc -lgcc +LDADD+= -lgcc -lsys -lgcc .elif ${CC} == "clang" +LDADD+= -L/usr/pkg/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic DPADD+= ${LIBC} -LDADD+= -L/usr/pkg/lib -LDADD+= -lCompilerRT-Generic -lc -lCompilerRT-Generic .endif - .endif CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR} diff --git a/nbsd_include/stdlib.h b/nbsd_include/stdlib.h index b52d3741b..63d334719 100644 --- a/nbsd_include/stdlib.h +++ b/nbsd_include/stdlib.h @@ -244,6 +244,8 @@ int posix_memalign(void **, size_t, size_t); void *alloca(int); /* built-in for gcc */ #elif defined(__PCC__) && !defined(__GNUC__) #define alloca(size) __builtin_alloca(size) +#elif (__GNUC__ >= 2) +#define alloca(size) __builtin_alloca(size) #else void *alloca(size_t); #endif /* __GNUC__ */ diff --git a/servers/Makefile.inc b/servers/Makefile.inc index 2e67ce5b0..5862b1bca 100644 --- a/servers/Makefile.inc +++ b/servers/Makefile.inc @@ -1,4 +1,4 @@ -.if (${NBSD_LIBC} != "no") +.if ${COMPILER_TYPE} == "gnu" CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE LDADD+= -lminlib -lcompat_minix DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX} diff --git a/servers/devman/Makefile b/servers/devman/Makefile index a839f535f..c854b1e91 100644 --- a/servers/devman/Makefile +++ b/servers/devman/Makefile @@ -9,4 +9,4 @@ BINDIR?= /sbin INSTALLFLAGS+= -S 128k MAN= -.include +.include diff --git a/servers/ext2/Makefile b/servers/ext2/Makefile index b5af34d2a..02e4aa8c4 100644 --- a/servers/ext2/Makefile +++ b/servers/ext2/Makefile @@ -16,4 +16,4 @@ INSTALLFLAGS+= -S 128k DEFAULT_NR_BUFS= 1024 CPPFLAGS+= -DDEFAULT_NR_BUFS=${DEFAULT_NR_BUFS} -.include +.include diff --git a/servers/hgfs/Makefile b/servers/hgfs/Makefile index 11036e7f8..eadf787c9 100644 --- a/servers/hgfs/Makefile +++ b/servers/hgfs/Makefile @@ -11,4 +11,4 @@ MAN= BINDIR?= /sbin -.include +.include diff --git a/servers/inet/Makefile b/servers/inet/Makefile index 441d768e7..85bf04956 100644 --- a/servers/inet/Makefile +++ b/servers/inet/Makefile @@ -21,4 +21,4 @@ BINDIR?= /usr/sbin CPPFLAGS+= -I${.CURDIR} -D_MINIX -.include +.include diff --git a/servers/init/Makefile b/servers/init/Makefile index f48e32e3a..4feb4c52b 100644 --- a/servers/init/Makefile +++ b/servers/init/Makefile @@ -1,4 +1,6 @@ # Makefile for the init program (INIT) +.include + PROG= init SRCS= init.c @@ -7,4 +9,8 @@ MAN= BINDIR?= /usr/sbin INSTALLFLAGS+= -S 64k -.include +.if ${OBJECT_FMT} == "ELF" +LDFLAGS+= -Wl,--section-start=.init=0x0 +.endif + +.include diff --git a/servers/ipc/Makefile b/servers/ipc/Makefile index 5d470e897..89225c7d2 100644 --- a/servers/ipc/Makefile +++ b/servers/ipc/Makefile @@ -9,4 +9,4 @@ MAN= BINDIR?= /usr/sbin -.include +.include diff --git a/servers/is/Makefile b/servers/is/Makefile index c7fffb4d3..811068304 100644 --- a/servers/is/Makefile +++ b/servers/is/Makefile @@ -13,4 +13,4 @@ CPPFLAGS.dmp_kernel.c+= -I${MINIXSRCDIR} CPPFLAGS.dmp_rs.c+= -I${MINIXSRCDIR} CPPFLAGS.dmp_vm.c+= -I${MINIXSRCDIR} -.include +.include diff --git a/servers/iso9660fs/Makefile b/servers/iso9660fs/Makefile index 9be9225ea..3e79a43eb 100644 --- a/servers/iso9660fs/Makefile +++ b/servers/iso9660fs/Makefile @@ -13,4 +13,4 @@ BINDIR?= /sbin NR_BUFS= 100 CPPFLAGS+= -DNR_BUFS=${NR_BUFS} -.include +.include diff --git a/servers/lwip/Makefile b/servers/lwip/Makefile index 728984673..4191d7fc7 100644 --- a/servers/lwip/Makefile +++ b/servers/lwip/Makefile @@ -23,4 +23,4 @@ CPPFLAGS+= -I${.CURDIR}/../../lib/liblwip/include CFLAGS += -Wextra -std=c99 -.include +.include diff --git a/servers/procfs/Makefile b/servers/procfs/Makefile index a479da817..04356f9d1 100644 --- a/servers/procfs/Makefile +++ b/servers/procfs/Makefile @@ -11,4 +11,4 @@ MAN= BINDIR?= /sbin -.include +.include diff --git a/share/mk/Makefile b/share/mk/Makefile index 5bb2943db..8b0668b59 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -11,7 +11,7 @@ FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \ pkgsrchooks.mk sys.mk # MINIX-specific files -FILES+= minix.bootprog.mk +FILES+= minix.bootprog.mk minix.service.mk FILESDIR=/usr/share/mk .endif diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 3e0de997a..721e2b849 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -187,12 +187,6 @@ _LDADD.${_P}= ${LDADD} ${LDADD.${_P}} _LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}} _LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}} -.if defined(NBSD_LIBC) && (${NBSD_LIBC} == "yes") && \ - !empty(_LDADD.${_P}:M-lsys) -# defined(USE_LIBSYS) && (${USE_LIBSYS} == "yes") -_LDADD.${_P}+= -nodefaultlibs -lgcc -lsys -lgcc -.endif - ##### Build and install rules .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss]) SRCS+= ${SRCS.${_P}} # For bsd.dep.mk diff --git a/share/mk/minix.bootprog.mk b/share/mk/minix.bootprog.mk index 01a8001ff..4df1a8733 100644 --- a/share/mk/minix.bootprog.mk +++ b/share/mk/minix.bootprog.mk @@ -5,4 +5,4 @@ LDFLAGS+= -Wl,--section-start=.init=0x0 .endif -.include +.include diff --git a/share/mk/minix.service.mk b/share/mk/minix.service.mk new file mode 100644 index 000000000..52e47487a --- /dev/null +++ b/share/mk/minix.service.mk @@ -0,0 +1,14 @@ +# MINIX-specific servers/drivers options +.include + +.if ${COMPILER_TYPE} == "gnu" + +.if ${CC} == "gcc" +LDADD+= -nodefaultlibs -lgcc -lsys -lgcc +.elif ${CC} == "clang" +LDADD+= -nodefaultlibs -L/usr/pkg/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic +.endif + +.endif + +.include -- 2.44.0