This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [build] Move crtfastmath to toplevel libgcc


Richard Henderson <rth@redhat.com> writes:

> On 07/11/2011 10:26 AM, Rainer Orth wrote:
>> There's one other question here: alpha/t-crtfm uses
>> -frandom-seed=gcc-crtfastmath with this comment:
>> 
>> # FIXME drow/20061228 - I have preserved this -frandom-seed option
>> # while migrating this rule from the GCC directory, but I do not
>> # know why it is necessary if no other crt file uses it.
>> 
>> Is there any particular reason to either keep this or not to use it in
>> the generic file?  This way, only i386 needs to stay separate with its
>> use of -msse -minline-all-stringops.
>
> This random-seed thing is there for the mangled name we build
> for the constructor on Tru64.
>
> It's not needed for any target for which a .ctors section is
> supported.  It also doesn't hurt, so you could move it to any
> generic build rule.

This is what I've done.  Here's the revised patch, currently
bootstrapping on alpha-dec-osf5.1b and well into building the target
libraries.

After committing the Darwin crt[23].o patch and before continuing with
the i386/crtprec??.o one, I noticed that this would leave Darwin/x86 in
a broken state: gcc/config/i386/t-crtfm still has 

EXTRA_PARTS += crtfastmath.o

which is missing in libgcc/config.host, thus the extra_parts comparison
will fail and break bootstrap ;-(

Do you think the revised crtfastmath patch is safe enough to commit
together to avoid this mess?

Thanks.
        Rainer


2011-07-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/alpha/crtfastmath.c: Move to ../libgcc/config/alpha.
	* config/alpha/t-crtfm: Remove.
	* config/i386/crtfastmath.c: Move to ../libgcc/config/i386.
	* config/i386/t-crtfm: Remove.
	* config/ia64/crtfastmath.c: Move to ../libgcc/config/ia64.
	* config/mips/crtfastmath.c: Move to ../libgcc/config/mips.
	* config/sparc/crtfastmath.c: Move to ../libgcc/config/sparc.
	* config/sparc/t-crtfm: Remove.

	* config.gcc (alpha*-*-linux*): Remove alpha/t-crtfm from tmake_file.
	(alpha*-*-freebsd*): Likewise.
	(i[34567]86-*-darwin*): Remove i386/t-crtfm from tmake_file.
	(x86_64-*-darwin*): Likewise.
	(i[34567]86-*-linux*): Likewise.
	(x86_64-*-linux*): Likewise.
	(x86_64-*-mingw*): Likewise.
	(ia64*-*-elf*): Remove crtfastmath.o from extra_parts.
	(ia64*-*-freebsd*): Likewise.
	(ia64*-*-linux*): Likewise.
	(mips64*-*-linux*): Likewise.
	(mips*-*-linux*): Likewise.
	(sparc-*-linux*): Remove sparc/t-crtfm from tmake_file.
	(sparc64-*-linux*): Likewise.
	(sparc64-*-freebsd*): Likewise.

	libgcc:
	* config/alpha/crtfastmath.c: New file.
	* config/i386/crtfastmath.c: New file.
	* config/ia64/crtfastmath.c: New file.
	* config/mips/crtfastmath.c: New file.
	* config/sparc/crtfastmath.c: New file.

	* config/t-crtfm (crtfastmath.o): Use $(srcdir) to refer to
	crtfastmath.c.
	Add -frandom-seed=gcc-crtfastmath.
	* config/alpha/t-crtfm: Remove.
	* config/i386/t-crtfm: Use $(srcdir) to refer to crtfastmath.c.
	* config/ia64/t-ia64 (crtfastmath.o): Remove.

	* config.host (alpha*-*-linux*): Replace alpha/t-crtfm by t-crtfm.
	(alpha*-dec-osf5.1*): Likewise.
	(alpha*-*-freebsd*): Add t-crtfm to tmake_file.
	Add crtfastmath.o to extra_parts.
	(i[34567]86-*-darwin*): Add i386/t-crtfm to tmake_file.
	Add crtfastmath.o to extra_parts.
	(x86_64-*-darwin*): Likewise.
	(x86_64-*-mingw*): Likewise.
	(ia64*-*-elf*): Add t-crtfm to tmake_file.
	(ia64*-*-freebsd*): Likewise.
	(ia64*-*-linux*): Likewise.
	(sparc64-*-freebsd*): Add t-crtfm to tmake_file.
	Add crtfastmath.o to extra_parts.

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -756,13 +756,13 @@ alpha*-*-linux*)
 	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
 	extra_options="${extra_options} alpha/elf.opt"
 	target_cpu_default="MASK_GAS"
-	tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee alpha/t-linux"
+	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee alpha/t-linux"
 	;;
 alpha*-*-freebsd*)
 	tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
 	extra_options="${extra_options} alpha/elf.opt"
 	target_cpu_default="MASK_GAS"
-	tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
+	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee"
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
 	;;
 alpha*-*-netbsd*)
@@ -1208,12 +1208,12 @@ i[34567]86-*-darwin*)
 	need_64bit_isa=yes
 	# Baseline choice for a machine that allows m64 support.
 	with_cpu=${with_cpu:-core2}
-	tmake_file="${tmake_file} t-slibgcc-dummy i386/t-crtpc i386/t-crtfm"
+	tmake_file="${tmake_file} t-slibgcc-dummy i386/t-crtpc"
 	libgcc_tm_file="$libgcc_tm_file i386/darwin-lib.h"
 	;;
 x86_64-*-darwin*)
 	with_cpu=${with_cpu:-core2}
-	tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy i386/t-crtpc i386/t-crtfm"
+	tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy i386/t-crtpc"
 	tm_file="${tm_file} ${cpu_type}/darwin64.h"
 	libgcc_tm_file="$libgcc_tm_file i386/darwin-lib.h"
 	;;
@@ -1311,7 +1311,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfree
 	i[34567]86-*-kopensolaris*-gnu) tm_file="${tm_file} i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h" ;;
 	i[34567]86-*-gnu*) tm_file="$tm_file i386/gnu-user.h gnu.h i386/gnu.h";;
 	esac
-	tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc i386/t-crtfm"
+	tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc"
 	;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h \
@@ -1323,7 +1323,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu
 	x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h" ;;
 	x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;;
 	esac
-	tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm"
+	tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc"
 	x86_multilibs="${with_multilib_list}"
 	if test "$x86_multilibs" = "default"; then
 		x86_multilibs="m64,m32"
@@ -1560,13 +1560,6 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 	    ;;
 	esac
 	case ${target} in
-		x86_64-*-mingw*)
-			tmake_file="${tmake_file} i386/t-crtfm"
-			;;
-		*)
-			;;
-	esac
-	case ${target} in
  		*mingw32crt*)
  			tm_file="${tm_file} i386/crtdll.h"
  			;;
@@ -1599,19 +1592,19 @@ ia64*-*-elf*)
 	then
 		target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
 	fi
-	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
+	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
 	;;
 ia64*-*-freebsd*)
 	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
 	tmake_file="${tmake_file} ia64/t-ia64"
-	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
+	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
 	;;
 ia64*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
 	tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
-	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
+	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
 	;;
 ia64*-*-hpux*)
 	tm_file="${tm_file} dbxelf.h elfos.h ia64/sysv4.h ia64/hpux.h"
@@ -1851,7 +1844,6 @@ mips64*-*-linux* | mipsisa64*-*-linux*)
 			tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
 			;;
 	esac
-	extra_parts="$extra_parts crtfastmath.o"
 	gnu_ld=yes
 	gas=yes
 	test x$with_llsc != x || with_llsc=yes
@@ -1871,7 +1863,6 @@ mips*-*-linux*)				# Linux MIPS, either 
         mipsisa32*)
 		tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32"
         esac
-	extra_parts="$extra_parts crtfastmath.o"
 	test x$with_llsc != x || with_llsc=yes
 	;;
 mips*-*-openbsd*)
@@ -2499,7 +2490,6 @@ sparc-*-linux*)
 	else
 		tm_file="${tm_file} sparc/linux.h"
 	fi
-	tmake_file="${tmake_file} sparc/t-crtfm"
 	;;
 sparc-*-netbsdelf*)
 	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h"
@@ -2534,12 +2524,11 @@ sparc64-*-rtems*)
 sparc64-*-linux*)
 	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/linux64.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
-	tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64 sparc/t-crtfm"
+	tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64"
 	;;
 sparc64-*-freebsd*|ultrasparc-*-freebsd*)
 	tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
-	tmake_file="${tmake_file} sparc/t-crtfm"
 	case "x$with_cpu" in
 		xultrasparc) ;;
 		x) with_cpu=ultrasparc ;;
diff --git a/gcc/config/alpha/t-crtfm b/gcc/config/alpha/t-crtfm
deleted file mode 100644
--- a/gcc/config/alpha/t-crtfm
+++ /dev/null
@@ -1,5 +0,0 @@
-EXTRA_PARTS += crtfastmath.o
-
-$(T)crtfastmath.o: $(srcdir)/config/alpha/crtfastmath.c $(GCC_PASSES)
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -frandom-seed=gcc-crtfastmath -c \
-		-o $(T)crtfastmath.o $(srcdir)/config/alpha/crtfastmath.c
diff --git a/gcc/config/i386/t-crtfm b/gcc/config/i386/t-crtfm
deleted file mode 100644
--- a/gcc/config/i386/t-crtfm
+++ /dev/null
@@ -1,8 +0,0 @@
-EXTRA_PARTS += crtfastmath.o
-
-$(T)crtfastmath.o: $(srcdir)/config/i386/crtfastmath.c \
-  $(srcdir)/config/i386/cpuid.h $(GCC_PASSES)
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(MULTILIB_CFLAGS) \
-		-msse -minline-all-stringops -c \
-		$(srcdir)/config/i386/crtfastmath.c \
-		-o $(T)crtfastmath$(objext)
diff --git a/gcc/config/sparc/t-crtfm b/gcc/config/sparc/t-crtfm
deleted file mode 100644
--- a/gcc/config/sparc/t-crtfm
+++ /dev/null
@@ -1,4 +0,0 @@
-EXTRA_PARTS += crtfastmath.o
-
-$(T)crtfastmath.o: $(srcdir)/config/sparc/crtfastmath.c $(GCC_PASSES)
-	$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) $(LIBGCC2_CFLAGS) -c -o $(T)crtfastmath.o $(srcdir)/config/sparc/crtfastmath.c
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -235,18 +235,20 @@ esac
 
 case ${host} in
 alpha*-*-linux*)
-	tmake_file="${tmake_file} alpha/t-crtfm"
+	tmake_file="${tmake_file} t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
 	md_unwind_header=alpha/linux-unwind.h
 	;;
 alpha*-*-freebsd*)
+	tmake_file="${tmake_file} t-crtfm"
+	extra_parts="$extra_parts crtfastmath.o"
 	;;
 alpha*-*-netbsd*)
 	;;
 alpha*-*-openbsd*)
 	;;
 alpha*-dec-osf5.1*)
-	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee alpha/t-crtfm t-slibgcc alpha/t-slibgcc-osf"
+	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee t-crtfm t-slibgcc alpha/t-slibgcc-osf"
 	case ${target_thread_file} in
 	  posix)
 	    tmake_file="${tmake_file} alpha/t-osf-pthread"
@@ -379,9 +381,12 @@ hppa[12]*-*-hpux11*)
 	md_unwind_header=pa/hpux-unwind.h
 	;;
 i[34567]86-*-darwin*)
+	tmake_file="$tmake_file i386/t-crtfm"
+	extra_parts="$extra_parts crtfastmath.o"
 	;;
 x86_64-*-darwin*)
-	tmake_file="t-darwin ${cpu_type}/t-darwin64 t-slibgcc-darwin"
+	tmake_file="t-darwin ${cpu_type}/t-darwin64 i386/t-crtfm t-slibgcc-darwin"
+	extra_parts="$extra_parts crtfastmath.o"
 	;;
 i[34567]86-*-elf*)
 	;;
@@ -453,21 +458,22 @@ i[34567]86-*-mingw*)
 	md_unwind_header=i386/w32-unwind.h
 	;;
 x86_64-*-mingw*)
-	tmake_file=t-dfprules
+	tmake_file="t-dfprules i386/t-crtfm"
+	extra_parts="$extra_parts crtfastmath.o"
 	;;
 i[34567]86-*-interix3*)
 	;;
 ia64*-*-elf*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 ia64/t-eh-ia64"
+	tmake_file="ia64/t-ia64 t-crtfm ia64/t-eh-ia64"
 	;;
 ia64*-*-freebsd*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 ia64/t-eh-ia64"
+	tmake_file="ia64/t-ia64 t-crtfm ia64/t-eh-ia64"
 	;;
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
+	tmake_file="ia64/t-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
 	if test x$with_system_libunwind != xyes ; then
 		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
 	fi
@@ -764,6 +770,8 @@ sparc64-*-rtems*)
 sparc-wrs-vxworks)
 	;;
 sparc64-*-freebsd*|ultrasparc-*-freebsd*)
+	tmake_file="$tmake_file t-crtfm"
+	extra_parts=crtfastmath.o
 	;;
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
 	extra_parts="$extra_parts crtfastmath.o"
diff --git a/gcc/config/alpha/crtfastmath.c b/libgcc/config/alpha/crtfastmath.c
rename from gcc/config/alpha/crtfastmath.c
rename to libgcc/config/alpha/crtfastmath.c
diff --git a/libgcc/config/alpha/t-crtfm b/libgcc/config/alpha/t-crtfm
deleted file mode 100644
--- a/libgcc/config/alpha/t-crtfm
+++ /dev/null
@@ -1,5 +0,0 @@
-# FIXME drow/20061228 - I have preserved this -frandom-seed option
-# while migrating this rule from the GCC directory, but I do not
-# know why it is necessary if no other crt file uses it.
-crtfastmath.o: $(gcc_srcdir)/config/alpha/crtfastmath.c
-	$(gcc_compile) -frandom-seed=gcc-crtfastmath -c $<
diff --git a/gcc/config/i386/crtfastmath.c b/libgcc/config/i386/crtfastmath.c
rename from gcc/config/i386/crtfastmath.c
rename to libgcc/config/i386/crtfastmath.c
diff --git a/libgcc/config/i386/t-crtfm b/libgcc/config/i386/t-crtfm
--- a/libgcc/config/i386/t-crtfm
+++ b/libgcc/config/i386/t-crtfm
@@ -1,4 +1,4 @@
 # This is an endfile, Use -minline-all-stringops to ensure
 # that __builtin_memset doesn't refer to the lib function memset().
-crtfastmath.o: $(gcc_srcdir)/config/i386/crtfastmath.c
+crtfastmath.o: $(srcdir)/config/i386/crtfastmath.c
 	$(gcc_compile) -msse -minline-all-stringops -c $<
diff --git a/gcc/config/ia64/crtfastmath.c b/libgcc/config/ia64/crtfastmath.c
rename from gcc/config/ia64/crtfastmath.c
rename to libgcc/config/ia64/crtfastmath.c
diff --git a/libgcc/config/ia64/t-ia64 b/libgcc/config/ia64/t-ia64
--- a/libgcc/config/ia64/t-ia64
+++ b/libgcc/config/ia64/t-ia64
@@ -13,6 +13,3 @@ crtbeginS.o: $(gcc_srcdir)/config/ia64/c
 crtendS.o: $(gcc_srcdir)/config/ia64/crtend.asm
 	$(CC) $(compile_deps) -I. -I$(gcc_objdir) -c -x assembler-with-cpp \
 		-o $@ -DSHARED $(gcc_srcdir)/config/ia64/crtend.asm
-
-crtfastmath.o: $(gcc_srcdir)/config/ia64/crtfastmath.c
-	$(gcc_compile) -c $(gcc_srcdir)/config/ia64/crtfastmath.c
diff --git a/gcc/config/mips/crtfastmath.c b/libgcc/config/mips/crtfastmath.c
rename from gcc/config/mips/crtfastmath.c
rename to libgcc/config/mips/crtfastmath.c
diff --git a/gcc/config/sparc/crtfastmath.c b/libgcc/config/sparc/crtfastmath.c
rename from gcc/config/sparc/crtfastmath.c
rename to libgcc/config/sparc/crtfastmath.c
diff --git a/libgcc/config/t-crtfm b/libgcc/config/t-crtfm
--- a/libgcc/config/t-crtfm
+++ b/libgcc/config/t-crtfm
@@ -1,2 +1,4 @@
-crtfastmath.o: $(gcc_srcdir)/config/$(cpu_type)/crtfastmath.c
-	$(gcc_compile) -c $<
+# -frandom-seed is necessary to keep the mangled name of the constructor on
+# Tru64 Unix stable, but harmless otherwise.
+crtfastmath.o: $(srcdir)/config/$(cpu_type)/crtfastmath.c
+	$(gcc_compile) -frandom-seed=gcc-crtfastmath -c $<

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]