This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Improve darwin X darwin cross support
- From: Geoffrey Keating <gkeating at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Aug 2003 19:57:14 -0700 (PDT)
- Subject: Improve darwin X darwin cross support
This improves support for crosses between Darwin platforms. You
should now be able to
<foo>/configure --target=<processor>-apple-darwin
on a Darwin platform, and have it Just Work. Well, you do need to
create an <processor>-apple-darwin-ar and
<processor>-apple-darwin-ranlib, but you can make them shell scripts
that call the usual Darwin 'ar' and 'ranlib'.
Tested by building a cross to i386-darwin from powerpc-darwin, and
bootstrapping a powerpc-darwin native.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-ezi386darwincross.patch===============
2003-08-19 Geoffrey Keating <geoffk@apple.com>
* config/darwin.h (LINK_COMMAND_SPEC): Add -arch and -arch_only
options.
* config/i386/darwin.h (ASM_SPEC): New.
(SUBTARGET_EXTRA_SPECS): New.
* config/rs6000/darwin.h (ASM_SPEC): New.
(SUBTARGET_EXTRA_SPECS): New.
* configure.in: Don't set CROSS or SYSTEM_HEADER_DIR when building
a cross-compiler between two different processors on Darwin.
* configure: Regenerate.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.716
diff -u -p -u -p -r1.716 configure.in
--- configure.in 14 Aug 2003 20:25:14 -0000 1.716
+++ configure.in 20 Aug 2003 02:53:52 -0000
@@ -1414,6 +1414,21 @@ then
ALL=all.cross
SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
case "$host","$target" in
+ # Darwin crosses can use the host system's libraries and headers,
+ # because of the fat library support. Of course, it must be the
+ # same version of Darwin on both sides. Allow the user to
+ # just say --target=foo-darwin without a version number to mean
+ # "the version on this system".
+ *-*-darwin*,*-*-darwin*)
+ hostos=`echo $host | sed 's/.*-darwin/darwin/'`
+ targetos=`echo $target | sed 's/.*-darwin/darwin/'`
+ if test $hostos = $targetos -o $targetos = darwin ; then
+ CROSS=
+ SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
+ with_headers=yes
+ fi
+ ;;
+
i?86-*-*,x86_64-*-* \
| powerpc*-*-*,powerpc64*-*-*)
CROSS="$CROSS -DNATIVE_CROSS" ;;
Index: config/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.59
diff -u -p -u -p -r1.59 darwin.h
--- config/darwin.h 17 Aug 2003 10:00:03 -0000 1.59
+++ config/darwin.h 20 Aug 2003 02:53:52 -0000
@@ -186,6 +186,8 @@ Boston, MA 02111-1307, USA. */
#define LINK_COMMAND_SPEC "\
%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
+ %{!Zdynamiclib:-arch %(darwin_arch)} \
+ %{Zdynamiclib:-arch_only %(darwin_arch)} \
%l %X %{d} %{s} %{t} %{Z} \
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
Index: config/i386/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/darwin.h,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 darwin.h
--- config/i386/darwin.h 4 Jun 2003 17:33:50 -0000 1.6
+++ config/i386/darwin.h 20 Aug 2003 02:53:52 -0000
@@ -41,6 +41,16 @@ Boston, MA 02111-1307, USA. */
#undef CC1_SPEC
#define CC1_SPEC "%{!static:-fPIC}"
+#define ASM_SPEC "-arch i386 \
+ %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
+ %{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\
+ %{msse:-force_cpusubtype_ALL}\
+ %{msse2:-force_cpusubtype_ALL}}"
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "darwin_arch", "i386" },
+
/* The Darwin assembler mostly follows AT&T syntax. */
#undef ASSEMBLER_DIALECT
#define ASSEMBLER_DIALECT ASM_ATT
Index: config/rs6000/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/darwin.h,v
retrieving revision 1.39
diff -u -p -u -p -r1.39 darwin.h
--- config/rs6000/darwin.h 5 Jul 2003 00:08:10 -0000 1.39
+++ config/rs6000/darwin.h 20 Aug 2003 02:53:52 -0000
@@ -97,6 +97,14 @@ do { \
%{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
%{!static:%{!mdynamic-no-pic:-fPIC}}"
+#define ASM_SPEC "-arch ppc \
+ %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
+ %{!Zforce_cpusubtype_ALL:%{faltivec:-force_cpusubtype_ALL}}"
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "darwin_arch", "ppc" },
+
/* Make both r2 and r3 available for allocation. */
#define FIXED_R2 0
#define FIXED_R13 0
============================================================