]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Add x86_64 target to toolchain.
authorArne Fitzenreiter <arne_f@ipfire.org>
Tue, 18 Aug 2009 21:41:20 +0000 (23:41 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Tue, 18 Aug 2009 21:41:20 +0000 (23:41 +0200)
lfs/gcc
lfs/gmp
lfs/stage1
lfs/stage2
tools/make-constants

diff --git a/lfs/gcc b/lfs/gcc
index 8b1ea5ce67ce1f38c876e4302832611c278ce606..25889c0a5a679a671afcb7662ffab6a18324bd24 100644 (file)
--- a/lfs/gcc
+++ b/lfs/gcc
@@ -61,9 +61,19 @@ CXXFLAGS   =
 GMP        = $(shell grep ^PKG_VER $(DIR_LFS)/gmp  | awk '{ print $$3 }')
 MPFR       = $(shell grep ^PKG_VER $(DIR_LFS)/mpfr | awk '{ print $$3 }')
 
+ifneq "$(STAGE)" "base"
 ifeq "$(MACHINE)" "i586"
        CONFIGURE_ARGS = --disable-decimal-float
 endif
+endif
+
+ifeq "$(MACHINE)" "x86_64"
+       CONFIGURE_ARGS = --without-cloog --without-ppl --disable-multilib
+endif
+
+ifneq "$(MACHINE)" "x86_64"
+       CONFIG_CPU = --with-cpu=$(MACHINE) --with-arch=$(MACHINE)
+endif
 
 ###############################################################################
 # Top-level Rules
@@ -116,6 +126,8 @@ ifeq "$(PASS)" "1"
        ## Enable -fPIC by default
        cd $(DIR_APP) && sed 's/^\(#define CC1_SPEC.*\)\("\)$$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \
                -i gcc/config/i386/linux.h
+       cd $(DIR_APP) && sed 's/^\(#define CC1_SPEC.*\)\("\)$$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \
+               -i gcc/config/i386/x86-64.h
 
        # libssp has no use with new versions of Glibc. Glibc completely replaces all 
        # functions in libssp, linking to libssp will cause conflicts with libc, so 
@@ -126,8 +138,7 @@ ifeq "$(PASS)" "1"
                ../$(THISAPP)/configure \
                        $(CONFIGURE_ARCH) \
                        --target=$(IFS_TARGET) \
-                       --with-cpu=$(MACHINE) \
-                       --with-arch=$(MACHINE) \
+                       $(CONFIG_CPU) \
                        --prefix=$(TOOLS_DIR) \
                        --with-local-prefix=$(TOOLS_DIR) \
                        --libexecdir=$(TOOLS_DIR)/lib \
@@ -166,6 +177,14 @@ ifeq "$(PASS)" "2"
                        touch $$file.orig; \
                done
 
+ifeq "$(MACHINE)" "x86_64"
+       # Remove multilib options and searchpath (/lib... /usr/lib...)
+       cd $(DIR_APP) && echo "" > gcc/config/i386/t-linux64
+       ## Enable -fPIC by default (why i have to do this again ???)
+       cd $(DIR_APP) && sed 's/^\(#define CC1_SPEC.*\)\("\)$$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \
+               -i gcc/config/i386/x86-64.h
+endif
+
        # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
        # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
        cd $(DIR_APP) && sed -e "s/-Werror//" -i libgomp/configure
@@ -175,8 +194,7 @@ ifeq "$(PASS)" "2"
                ../$(THISAPP)/configure \
                        $(CONFIGURE_ARCH) \
                        --target=$(IFS_TARGET) \
-                       --with-cpu=$(MACHINE) \
-                       --with-arch=$(MACHINE) \
+                       $(CONFIG_CPU) \
                        --prefix=$(TOOLS_DIR) \
                        --with-local-prefix=$(TOOLS_DIR) \
                        --libexecdir=$(TOOLS_DIR)/lib \
@@ -213,8 +231,7 @@ ifeq "$(STAGE)" "base"
                ../$(THISAPP)/configure \
                        $(CONFIGURE_ARCH) \
                        --target=$(IFS_TARGET) \
-                       --with-cpu=$(MACHINE) \
-                       --with-arch=$(MACHINE) \
+                       $(CONFIG_CPU) \
                        --prefix=/usr \
                        --libexecdir=/usr/lib \
                        --enable-espf \
@@ -226,7 +243,8 @@ ifeq "$(STAGE)" "base"
                        --disable-bootstrap \
                        --disable-werror \
                        --disable-libssp \
-                       --disable-static
+                       --disable-static \
+                       $(CONFIGURE_ARGS)
 
        cd $(DIR_SRC)/gcc-build && make $(PARALLELISMFLAGS)
        cd $(DIR_SRC)/gcc-build && make install
diff --git a/lfs/gmp b/lfs/gmp
index 03733f3fce8f452e16028f19264184bfb827f1fc..aec2eb185016b19c046884caf1fb8d436d97903c 100644 (file)
--- a/lfs/gmp
+++ b/lfs/gmp
@@ -56,6 +56,11 @@ define LONG_DESC
        emphasizes speed over simplicity/elegance in its operations.
 endef
 
+ifeq "$(MACHINE)" "x86_64"
+       ABI = 64
+else
+       ABI = 32
+endif
 ###############################################################################
 # Top-level Rules
 ###############################################################################
@@ -84,7 +89,7 @@ $(objects):
 $(OBJECT): $(objects)
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && $(EXTRACTOR) $(DIR_DL)/$(DL_FILE)
-       cd $(DIR_APP) && ABI=32 \
+       cd $(DIR_APP) && ABI=$(ABI) \
                ./configure \
                        $(CONFIGURE_ARCH) \
                        --prefix=/usr \
index dfed2a9e2f90d5e5afb934e7317572e8b4f2eb8a..38b8c972d504760a3ad9e43eef32f61e5ae7cc6f 100644 (file)
@@ -76,4 +76,8 @@ $(objects):
 $(OBJECT): $(objects)
        @$(PREBUILD)
        -mkdir -p $(TOOLS_DIR)/usr/bin
+ifeq "$(MACHINE)" "x86_64"
+       #Link lib64 to lib on 64bit target
+       ln -sf ./lib $(TOOLS_DIR)/lib64
+endif
        @$(POSTBUILD)
index a15a5af2d22ae9c59182fcade21fb35c3371f4d5..98ac3a09079ed0a9164ed0ddaeeff6ecd231f074 100644 (file)
@@ -115,4 +115,9 @@ $(OBJECT): $(objects)
        -mkdir -p /home/nobody
        chown -R nobody:nobody /home/nobody
 
+ifeq "$(MACHINE)" "x86_64"
+       # Link lib64 to lib for 64bit target
+       ln -sf lib /lib64
+       ln -sf lib /use/lib64
+endif
        @$(POSTBUILD)
index b6e1b2cba007f56d2a5e0f9edc42eba061019a64..6cb4e8659c679e46c7e1f1dbab38dbbd0e45715c 100644 (file)
@@ -26,7 +26,7 @@
 
 # Default target
 TARGET=${TARGET-i686}
-POSSIBLE_TARGETS="i686 i586 i486 via-c7 via-c3 geodelx atom core2duo"
+POSSIBLE_TARGETS="i686 i586 i486 via-c7 via-c3 geodelx atom core2duo x86_64"
 
 # Configuration rootdir
 CONFIG_ROOT=/etc/$SNAME
@@ -128,6 +128,12 @@ elif [ 'geodelx' = $TARGET ]; then
        CFLAGS="-Os -march=geode $GLOBAL_CFLAGS"
        CXXFLAGS="${CFLAGS}"
        ICECC=off
+elif [ 'x86_64' = $TARGET ]; then
+       MACHINE=x86_64
+       IFS_TARGET="${MACHINE}-pc-linux-gnu"
+       CFLAGS="-Os $GLOBAL_CFLAGS"
+       CXXFLAGS="${CFLAGS}"
+       LINKER=/lib64/ld-linux-x86-64.so.2
 else
        beautify message FAIL
        echo "Not a valid target arch ($POSSIBLE_TARGETS) - $TARGET"