mirror of https://github.com/l4ka/pistachio.git
Modifications to allow compiling 32-bit binaries on 64-bit machines
(x86) and vice-versa.
This commit is contained in:
parent
0fb28f1999
commit
9122175e1f
|
@ -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
|
||||
|
@ -88,9 +88,19 @@ 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_<arch>, CFLAGS_<cpu>, CFLAGS_<platform>
|
||||
# ASMFLAGS_<arch> ASMFLAGS_<cpu>, ASMFLAGS_<platform>
|
||||
# DEFINES_<arch>
|
||||
|
||||
-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_<arch>, CFLAGS_<cpu>, CFLAGS_<platform>
|
||||
# ASMFLAGS_<arch> ASMFLAGS_<cpu>, ASMFLAGS_<platform>
|
||||
# DEFINES_<arch>
|
||||
|
||||
-include $(SRCDIR)/Mk/Makeconf.$(ARCH)
|
||||
|
||||
|
||||
# these macros will be undefined first - they may have default values
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue