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]

-dynamiclib documentation, etc., for Darwin


This patch explains what -dynamiclib does, and a few other options
that were previously documented as 'see man ld(1)', but aren't
actually linker-specific options.  It also makes the compiler actually
do what's documented in a consistent way.

Will commit when bootstrap & test on powerpc-darwin and a cross
build of i686-darwin finish successfully.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-darwin-dynamiclib.patch===============
2004-10-29  Geoffrey Keating  <geoffk@apple.com>

	* config/i386/darwin.h (ASM_SPEC): Simplify.
	(SUBTARGET_EXTRA_SPECS): Add darwin_subarch spec.
	* config/rs6000/darwin.h (DARWIN_SUBARCH_SPEC): New.
	(SUBTARGET_EXTRA_SPECS): Add darwin_subarch spec.
	* config/darwin.h (LINK_COMMAND_SPEC): Don't pass -arch here.
	(LINK_SPEC): Do pass -arch here.  Handle -force_cpusubtype_ALL
	in all cases.  Pass the right -arch or -arch_only based on -mcpu.
	(ASM_SPEC): Handle -force_cpusubtype_ALL.
	* doc/invoke.texi (Darwin Options): Improve documentation for
	Darwin linker (and libtool) switches.

Index: config/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.102
diff -u -p -u -p -r1.102 darwin.h
--- config/darwin.h	27 Oct 2004 23:01:56 -0000	1.102
+++ config/darwin.h	30 Oct 2004 01:13:35 -0000
@@ -219,8 +219,6 @@ extern const char *darwin_fix_and_contin
 #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}} \
@@ -240,13 +238,14 @@ extern const char *darwin_fix_and_contin
   "%{static}%{!static:-dynamic} \
    %{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)}\
    %{!Zdynamiclib: \
+     %{Zforce_cpusubtype_ALL:-arch %(darwin_arch) -force_cpusubtype_ALL} \
+     %{!Zforce_cpusubtype_ALL:-arch %(darwin_subarch)} \
      %{Zbundle:-bundle} \
      %{Zbundle_loader*:-bundle_loader %*} \
      %{client_name*} \
      %{compatibility_version*:%e-compatibility_version only allowed with -dynamiclib\
 } \
      %{current_version*:%e-current_version only allowed with -dynamiclib} \
-     %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
      %{Zforce_flat_namespace:-force_flat_namespace} \
      %{Zinstall_name*:%e-install_name only allowed with -dynamiclib} \
      %{keep_private_externs} \
@@ -258,7 +257,8 @@ extern const char *darwin_fix_and_contin
      %{client_name*:%e-client_name not allowed with -dynamiclib} \
      %{compatibility_version*} \
      %{current_version*} \
-     %{Zforce_cpusubtype_ALL:%e-force_cpusubtype_ALL not allowed with -dynamiclib} \
+     %{Zforce_cpusubtype_ALL:-arch_only %(darwin_arch)} \
+     %{!Zforce_cpusubtype_ALL: -arch_only %(darwin_subarch)} \
      %{Zforce_flat_namespace:%e-force_flat_namespace not allowed with -dynamiclib} \
      %{Zinstall_name*:-install_name %*} \
      %{keep_private_externs:%e-keep_private_externs not allowed with -dynamiclib} \
@@ -332,7 +332,8 @@ extern const char *darwin_fix_and_contin
 /* #define ENDFILE_SPEC "" */
 
 /* Default Darwin ASM_SPEC, very simple.  */
-#define ASM_SPEC "-arch %(darwin_arch)"
+#define ASM_SPEC "-arch %(darwin_arch) \
+  %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL}"
 
 /* We use Dbx symbol format.  */
 
Index: config/i386/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/darwin.h,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 darwin.h
--- config/i386/darwin.h	26 Oct 2004 07:30:06 -0000	1.21
+++ config/i386/darwin.h	30 Oct 2004 01:13:35 -0000
@@ -45,16 +45,13 @@ Boston, MA 02111-1307, USA.  */
   %{g: %{!gfull: -feliminate-unused-debug-symbols %<gfull }}"
 
 #undef ASM_SPEC
-#define ASM_SPEC "-arch i686 \
-  -force_cpusubtype_ALL \
-  %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
-  %{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\
-			   %{msse:-force_cpusubtype_ALL}\
-			   %{msse2:-force_cpusubtype_ALL}}"
+#define ASM_SPEC "-arch i686 -force_cpusubtype_ALL"
 
 #undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS			\
-  { "darwin_arch", "i686" },
+#define SUBTARGET_EXTRA_SPECS					\
+  { "darwin_arch", "i686" },					\
+  { "darwin_subarch", "%{march=pentium3:pentIIm3;:i686}" },
+   
 
 /* Use the following macro for any Darwin/x86-specific command-line option
    translation.  */
Index: config/rs6000/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/darwin.h,v
retrieving revision 1.68
diff -u -p -u -p -r1.68 darwin.h
--- config/rs6000/darwin.h	29 Oct 2004 17:09:05 -0000	1.68
+++ config/rs6000/darwin.h	30 Oct 2004 01:13:36 -0000
@@ -132,9 +132,29 @@ do {									\
 %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
 %{!static:%{!mdynamic-no-pic:-fPIC}}"
 
+#define DARWIN_SUBARCH_SPEC "			\
+ %{m64: ppc64}					\
+ %{!m64:					\
+ %{mcpu=601:ppc601;				\
+   mcpu=603:ppc603;				\
+   mcpu=603e:ppc603;				\
+   mcpu=604:ppc604;				\
+   mcpu=604e:ppc604e;				\
+   mcpu=740:ppc750;				\
+   mcpu=750:ppc750;				\
+   mcpu=G3:ppc750;				\
+   mcpu=7400:ppc7400;				\
+   mcpu=G4:ppc7400;				\
+   mcpu=7450:ppc7450;				\
+   mcpu=970:ppc970;				\
+   mcpu=power4:ppc970;				\
+   mcpu=G5:ppc970;				\
+   :ppc}}"
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS			\
-  { "darwin_arch", "%{m64:ppc64} %{!m64:ppc}" },
+  { "darwin_arch", "%{m64:ppc64;:ppc}" },	\
+  { "darwin_subarch", DARWIN_SUBARCH_SPEC },
 
 /* Output a .machine directive.  */
 #undef TARGET_ASM_FILE_START
============================================================


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