diff --git a/kernel/Mk/Makeconf b/kernel/Mk/Makeconf index dc663df4..fcb2636e 100644 --- a/kernel/Mk/Makeconf +++ b/kernel/Mk/Makeconf @@ -1,7 +1,7 @@ ## -*- mode: Makefile; -*- ###################################################################### ## -## Copyright (C) 2001-2009, Karlsruhe University +## Copyright (C) 2001-2009, 2011, Karlsruhe University ## ## File path: Mk/Makeconf ## Description: Make settings for pistachio @@ -82,15 +82,25 @@ endif # If CC was not given by user, default to GCC for target architecture ifeq "$(origin CC)" "default" -CC= $(CCACHE) $(TOOLPREFIX)gcc +CC= $(CCACHE) $(TOOLPREFIX)gcc endif CC_VERSION = $(shell echo __GNUC__ | $(CC) -E - | grep -v "\#") CC_SUBVERSION = $(shell echo __GNUC_MINOR__ | $(CC) -E - | grep -v "\#") -GCCINSTALLDIR?= $(dir $(shell $(CC) -print-libgcc-file-name)) -LIBGCCINC?= $(GCCINSTALLDIR)include -LIBGCCDIR?= $(GCCINSTALLDIR) +###################################################################### +# +# Hardware specific options +# +# Known so far: CFLAGS_, CFLAGS_, CFLAGS_ +# ASMFLAGS_ ASMFLAGS_, ASMFLAGS_ +# DEFINES_ + +-include $(SRCDIR)/Mk/Makeconf.$(ARCH) + + +LIBGCCDIR?= $(dir $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)) +LIBGCCINC?= $(dir $(shell $(CC) $(CFLAGS) -print-file-name=include/stdarg.h)) # Some CCs (e.g., the native FreeBSD gcc) do not follow the regular # gcc conventions when it comes to the gcc include files. @@ -120,15 +130,6 @@ ifeq "$(SCHED)" "" SCHED= rr endif -###################################################################### -# -# Hardware specific options -# -# Known so far: CFLAGS_, CFLAGS_, CFLAGS_ -# ASMFLAGS_ ASMFLAGS_, ASMFLAGS_ -# DEFINES_ - --include $(SRCDIR)/Mk/Makeconf.$(ARCH) # these macros will be undefined first - they may have default values diff --git a/kernel/Mk/Makeconf.x86 b/kernel/Mk/Makeconf.x86 index e7562a57..83d893b4 100644 --- a/kernel/Mk/Makeconf.x86 +++ b/kernel/Mk/Makeconf.x86 @@ -1,6 +1,6 @@ ################ -*- mode: Makefile; -*- ############################# ## -## Copyright (C) 2007-2008, 2010, Karlsruhe University +## Copyright (C) 2007-2008, 2010-2011, Karlsruhe University ## ## File path: Mk/Makeconf.x86 ## @@ -37,15 +37,18 @@ endif UNDEFS += $(SUBARCH) DEFINES += __SUBARCH__=$(SUBARCH) -CFLAGS_x86_x32 += -O2 -mpreferred-stack-boundary=2 +CFLAGS_x86_x32 += -O2 -m32 -mpreferred-stack-boundary=2 CFLAGS_x86_x64 += -O2 -m64 -mcmodel=kernel -mno-red-zone CFLAGS_x86 += $(CFLAGS_x86_$(SUBARCH)) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 +LDFLAGS_x86_x32 += -melf_i386 LDFLAGS_x86_x64 += -melf_x86_64 -n -z max-page-size=4096 LDFLAGS_x86 += $(LDFLAGS_x86_$(SUBARCH)) +ASMFLAGS_x86_x32 += -m32 ASMFLAGS_x86_x64 += -m64 ASMFLAGS_x86 += $(ASMFLAGS_x86_$(SUBARCH)) +VFLAGS_x86_x32 = -m elf_i386 VFLAGS_x86_x64 = -m elf_x86_64 VFLAGS += $(VFLAGS_x86_$(SUBARCH)) diff --git a/user/configure.in b/user/configure.in index d7276466..264f82d7 100644 --- a/user/configure.in +++ b/user/configure.in @@ -62,6 +62,7 @@ case $HOST in ia32|x86|i386*|i486*|i586*|i686*) ARCH=ia32 KERNEL=x86-kernel + LIBGCCFLAGS=-m32 ;; powerpc64*|ppc64*) ARCH=powerpc64 @@ -71,7 +72,7 @@ case $HOST in ARCH=powerpc KERNEL=$ARCH-kernel ;; - amd64*) + amd64*|x86_64*) ARCH=amd64 KERNEL=x86-kernel LIBGCCFLAGS=-m64 @@ -288,7 +289,13 @@ case $ARCH in esac dnl Platform dependent settings. -case $HOST in +case $ARCH in + ia32*) + PLAT=amd64-pc99 + CFLAGS="$CFLAGS -m32" + LDFLAGS="$LDFLAGS -melf_i386" + AC_SUBST([PLAT]) + ;; amd64*) PLAT=amd64-pc99 CFLAGS="$CFLAGS -m64 -mno-red-zone"