This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[build] Move darwin-crt[23].c to toplevel libgcc
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Paolo Bonzini <bonzini at gnu dot org>, Mike Stump <mikestump at comcast dot net>
- Date: Tue, 12 Jul 2011 18:31:00 +0200
- Subject: [build] Move darwin-crt[23].c to toplevel libgcc
As a prerequisite to moving i386/crtprec.c to toplevel libgcc, it turned
out that I need to move darwin-crt[23].c first to avoid the problem with
inconsistent versions of extra_parts in gcc and libgcc:
http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00831.html
The following pretty mechanical patch does this.
Bootstraps on i386-apple-darwin9.8.0 and powerpc-apple-darwin9.8.0 are
well beyond stage1 now, so libgcc and thus crt?.o build correctly.
Ok for mainline if they pass?
Thanks.
Rainer
2011-07-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc:
* config/darwin-crt2.c: Move to ../libgcc/config/rs6000.
* config/darwin-crt3.c: Move to ../libgcc/config.
* config/t-darwin (EXTRA_MULTILIB_PARTS): Remove.
($(T)crt3$(objext)): Remove.
* config/rs6000/t-darwin (DARWIN_EXTRA_CRT_BUILD_CFLAGS): Remove.
($(T)crt2$(objext)): Remove.
* config.gcc (powerpc-*-darwin*): Remove extra_parts.
(powerpc64-*-darwin*): Likewise.
gcc/po:
* EXCLUDES (config/darwin-crt2.c): Remove.
libgcc:
* config/darwin-crt3.o: New file.
* config/rs6000/darwin-crt2.c: New file.
* config/t-darwin (crt3.o): New rule.
* config/rs6000/t-darwin (DARWIN_EXTRA_CRT_BUILD_CFLAGS): New variable.
(crt2.o): New rule.
* config.host (*-*-darwin*): Add crt3.o to extra_parts.
(powerpc-*-darwin*): Add crt2.o to extra_parts.
(powerpc64-*-darwin*): Likewise.
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2019,7 +2019,6 @@ picochip-*)
# ;;
powerpc-*-darwin*)
extra_options="${extra_options} rs6000/darwin.opt"
- extra_parts="crt2.o"
case ${target} in
*-darwin1[0-9]* | *-darwin[8-9]*)
tmake_file="${tmake_file} rs6000/t-darwin8"
@@ -2036,7 +2035,6 @@ powerpc-*-darwin*)
;;
powerpc64-*-darwin*)
extra_options="${extra_options} ${cpu_type}/darwin.opt"
- extra_parts="crt2.o"
tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy"
tm_file="${tm_file} ${cpu_type}/darwin8.h ${cpu_type}/darwin64.h"
extra_headers=altivec.h
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -25,8 +25,6 @@ LIB2FUNCS_STATIC_EXTRA = \
$(srcdir)/config/rs6000/darwin-fpsave.asm \
$(srcdir)/config/rs6000/darwin-vecsave.asm
-DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongcall -mmacosx-version-min=10.4
-
# The .asm files above are designed to run on all processors,
# even though they use AltiVec instructions. -Wa is used because
# -force_cpusubtype_ALL doesn't work with -dynamiclib.
@@ -39,10 +37,3 @@ TARGET_LIBGCC2_CFLAGS = -Wa,-force_cpusu
darwin-fpsave.o: $(srcdir)/config/rs6000/darwin-asm.h
darwin-tramp.o: $(srcdir)/config/rs6000/darwin-asm.h
-
-# Explain how to build crt2.o
-$(T)crt2$(objext): $(srcdir)/config/darwin-crt2.c $(GCC_PASSES) \
- $(TCONFIG_H) stmp-int-hdrs tsystem.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
- $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) \
- -c $(srcdir)/config/darwin-crt2.c -o $(T)crt2$(objext)
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -42,15 +42,6 @@ darwin-driver.o: $(srcdir)/config/darwin
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/darwin-driver.c
-# How to build crt3.o
-EXTRA_MULTILIB_PARTS=crt3.o
-# Pass -fno-tree-dominator-opts to work around bug 26840.
-$(T)crt3$(objext): $(srcdir)/config/darwin-crt3.c $(GCC_PASSES) \
- $(TCONFIG_H) stmp-int-hdrs tsystem.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
- -fno-tree-dominator-opts $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) \
- -c $(srcdir)/config/darwin-crt3.c -o $(T)crt3$(objext)
-
# -pipe because there's an assembler bug, 4077127, which causes
# it to not properly process the first # directive, causing temporary
# file names to appear in stabs, causing the bootstrap to fail. Using -pipe
diff --git a/gcc/po/EXCLUDES b/gcc/po/EXCLUDES
--- a/gcc/po/EXCLUDES
+++ b/gcc/po/EXCLUDES
@@ -22,7 +22,6 @@
# .def are examined to begin with.
# These files are part of libgcc, or target headers provided by gcc.
-config/darwin-crt2.c
config/vxlib.c
crtstuff.c
gbl-ctors.h
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -161,6 +161,7 @@ case ${host} in
*-*-darwin*)
asm_hidden_op=.private_extern
tmake_file="t-darwin ${cpu_type}/t-darwin t-slibgcc-darwin"
+ extra_parts=crt3.o
;;
*-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
# This is the place-holder for the generic a.out configuration
@@ -616,9 +617,11 @@ powerpc-*-darwin*)
;;
esac
tmake_file="$tmake_file rs6000/t-ibm-ldouble"
+ extra_parts="$extra_parts crt2.o"
;;
powerpc64-*-darwin*)
tmake_file="$tmake_file rs6000/t-ibm-ldouble"
+ extra_parts="$extra_parts crt2.o"
;;
powerpc-*-freebsd*)
tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-freebsd t-softfp-sfdf t-softfp"
diff --git a/gcc/config/darwin-crt3.c b/libgcc/config/darwin-crt3.c
rename from gcc/config/darwin-crt3.c
rename to libgcc/config/darwin-crt3.c
diff --git a/gcc/config/darwin-crt2.c b/libgcc/config/rs6000/darwin-crt2.c
rename from gcc/config/darwin-crt2.c
rename to libgcc/config/rs6000/darwin-crt2.c
diff --git a/libgcc/config/rs6000/t-darwin b/libgcc/config/rs6000/t-darwin
--- a/libgcc/config/rs6000/t-darwin
+++ b/libgcc/config/rs6000/t-darwin
@@ -1,3 +1,8 @@
+DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongcall -mmacosx-version-min=10.4
+
+crt2.o: $(srcdir)/config/rs6000/darwin-crt2.c
+ $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
+
LIB2ADD += $(srcdir)/config/rs6000/ppc64-fp.c
LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -1,3 +1,8 @@
+# Pass -fno-tree-dominator-opts to work around bug 26840.
+crt3.o: $(srcdir)/config/darwin-crt3.c
+ $(crt_compile) \
+ -fno-tree-dominator-opts $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
+
# Use unwind-dw2-fde-darwin
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-darwin.c \
$(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University