Commit 93e576b7 authored by Manuel Novoa III 's avatar Manuel Novoa III
Browse files

Get soft float working for gcc 3.3.2. Support for arm, mips, mipsel, powerpc.

parent 2d472b23
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ ARCH:=i386
#ARCH:=arm
#ARCH:=mips
#ARCH:=mipsel
# Possible issues remaining with powerpc and soft float.
#ARCH:=powerpc
#ARCH:=sh4
# Busybox link failing due to needing libgcc functions that are statics.
@@ -49,9 +48,8 @@ ARCH:=i386
# Enable this if you want to use an <arch>-linux-uclibc-* toolchain.
# Note that, to avoid configure problems with apps that don't support
# this tupple, we also put <arch>-linux-* symlinks in staging_dir/bin.
# WARNING -- This does not yet support soft-float builds.
# This is the preferred approach now.
USE_LINUX_UCLIBC:=true
#USE_LINUX_UCLIBC:=false

# If you are building a native gcc toolchain, do you want to
# build the old gcc-2.95 based toolchain, or would you prefer
@@ -82,6 +80,8 @@ WGET:=wget --passive-ftp
ifeq ($(USE_LINUX_UCLIBC),true)
OPTIMIZE_FOR_CPU=$(ARCH)
#OPTIMIZE_FOR_CPU=i686
# Note... gcc 2.95 does not seem to like anything higher than i586.
#OPTIMIZE_FOR_CPU=i586
#OPTIMIZE_FOR_CPU=whatever
else
# WARNING!!!  CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
@@ -91,15 +91,16 @@ endif

# Soft floating point options.
# Notes:
#   Currently builds with gcc 3.3 for i386, arm, mips, mipsel.
#   Currently builds with gcc 3.3 for arm, mips, mipsel, powerpc.
#   (i386 support will be added back in at some point.)
#   Only tested with multilib enabled.
#   For i386, long double is the same as double (64 bits).  While this
#      is unusual for x86, it seemed the best approach considering the
#      limitations in the gcc floating point emulation library.
#   For arm, soft float uses the usual libfloat routines.
#   The uClibc built will support _only_ applications compiled with the
#      -msoft-float flag.  To avoid CFLAGS problems, you may want to use
#      scripts similar to those in the build*/staging_dir/bin directory.
#   Custom specs files are used to set the default gcc mode to soft float
#      as a convenience, since you shouldn't link hard and soft float
#      together.  In fact, arm won't even let you.
# (Un)comment the appropriate line below.
#SOFT_FLOAT:=true
SOFT_FLOAT:=false
@@ -212,11 +213,6 @@ TARGETS+=ext2root
#
#############################################################

# The new stuff doesn't support soft float yet.
ifeq ($(USE_LINUX_UCLIBC),true)
SOFT_FLOAT:=false
endif

ifeq ($(SOFT_FLOAT),true)
SOFT_FLOAT_CONFIG_OPTION:=--without-float
TARGET_SOFT_FLOAT:=-msoft-float
@@ -243,7 +239,7 @@ endif
ifneq ($(BUILD_WITH_LARGEFILE),true)
DISABLE_LARGEFILE= --disable-largefile 
endif
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_SOFT_FLOAT)
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)

HOSTCC:=gcc
BASE_DIR:=${shell pwd}
@@ -269,7 +265,7 @@ KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-
TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-
endif

TARGET_CC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT)
TARGET_CC=$(TARGET_CROSS)gcc
STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note


@@ -291,10 +287,11 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
		AS=$(TARGET_CROSS)as \
		LD=$(TARGET_CROSS)ld \
		NM=$(TARGET_CROSS)nm \
		CC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) \
		GCC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) \
		CXX=$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) \
		CC=$(TARGET_CROSS)gcc \
		GCC=$(TARGET_CROSS)gcc \
		CXX=$(TARGET_CROSS)g++ \
		RANLIB=$(TARGET_CROSS)ranlib

ifeq ($(ENABLE_LOCALE),true)
DISABLE_NLS:=
else
+19 −0
Original line number Diff line number Diff line
@@ -160,6 +160,14 @@ $(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled
		   	$(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
		done; \
	);
ifeq ($(SOFT_FLOAT),true)
	# Replace specs file with one that defaults to soft float mode.
	if [ ! -f $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \
		echo staging dir specs file is missing ; \
		/bin/false ; \
	fi;
	cp $(SOURCE_DIR)/specs-$(ARCH)-soft-float $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
endif
	touch $(GCC_BUILD_DIR2)/.installed

gcc3_3: uclibc-configured binutils gcc3_3_initial $(LIBFLOAT_TARGET) uclibc \
@@ -209,8 +217,19 @@ $(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured
$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled
	PATH=$(TARGET_PATH) \
	$(MAKE) $(JLEVEL) DESTDIR=$(TARGET_DIR) -C $(GCC_BUILD_DIR3) install
ifeq ($(SOFT_FLOAT),true)
	# Replace specs file with one that defaults to soft float mode.
	if [ ! -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \
		echo target dir specs file is missing ; \
		/bin/false ; \
	fi;
	cp $(SOURCE_DIR)/specs-$(ARCH)-soft-float $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
	# Make sure gcc does not think we are cross compiling
	$(SED) "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
else
	# Remove broken specs file (cross compile flag is set).
	rm -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
endif
	-(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1)
	-(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1)
	-(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1)
+7 −0
Original line number Diff line number Diff line
@@ -33,6 +33,13 @@ $(DL_DIR)/$(UCLIBC_SOURCE):
	$(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)

$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
ifeq ($(SOFT_FLOAT),true)
	# Make sure we have a soft float specs file for this arch
	if [ ! -f $(SOURCE_DIR)/specs-$(ARCH)-soft-float ] ; then \
		echo soft float configured but no specs file for this arch ; \
		/bin/false ; \
	fi;
endif
	bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
	#(cd $(BUILD_DIR) ; ln -s $(DL_DIR)/uClibc)
	#-mkdir $(UCLIBC_DIR)
+14 −0
Original line number Diff line number Diff line
--- gcc-3.3.2-old/configure.in	2003-08-09 01:57:21.000000000 -0500
+++ gcc-3.3.2/configure.in	2004-01-15 12:46:29.000000000 -0600
@@ -1418,6 +1418,11 @@
 fi
 
 FLAGS_FOR_TARGET=
+case " $targargs " in
+ *" --nfp "* | *" --without-float "*)
+    FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -msoft-float'
+    ;;
+esac
 case " $target_configdirs " in
  *" newlib "*)
   case " $targargs " in
+4 −3
Original line number Diff line number Diff line
diff -urN libfloat-dist/Makefile libfloat/Makefile
--- libfloat-dist/Makefile	2003-10-26 00:33:45.000000000 -0500
+++ libfloat/Makefile	2003-10-26 01:07:26.000000000 -0500
@@ -1,7 +1,6 @@
@@ -1,7 +1,7 @@
 # Makefile for the Linux soft-float library
 
-CC=gcc -O2 -freg-struct-return -fomit-frame-pointer -D__LIBFLOAT__
-#CC=gcc -g -O2 -freg-struct-return -D__LIBFLOAT__
+CFLAGS= -O2 -freg-struct-return -fomit-frame-pointer -D__LIBFLOAT__
+CFLAGS= -O2 -freg-struct-return -fomit-frame-pointer -D__LIBFLOAT__ -msoft-float
+LIBGCC=$(shell $(CC) -print-libgcc-file-name)
 AR=ar
 
 all: libfloat.a libfloat.so.1
@@ -15,7 +16,7 @@ diff -urN libfloat-dist/Makefile libfloat/Makefile
 libfloat.so.1: softfloat.os fplib_glue.os
 	rm -f libfloat.so.1
-	gcc -shared -Wl,-soname,libfloat.so.1 softfloat.os fplib_glue.os -o libfloat.so.1
+	$(LD) -shared -soname=libfloat.so.1 softfloat.os fplib_glue.os -o libfloat.so.1
+	$(LD) -shared -soname=libfloat.so.1 softfloat.os fplib_glue.os -o libfloat.so.1 $(LIBGCC)
 
 softfloat.o: softfloat/bits64/softfloat.c
-	$(CC) -c -o softfloat.o -Isoftfloat/bits64/ARM-gcc softfloat/bits64/softfloat.c
Loading