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]

small -mmacosx-version-min fix for Darwin


My previous patch broke the case where the user passed
-mmacosx-version-min twice while linking on powerpc.  This fixes it
and adds some testcases.

Bootstrapped & tested on powerpc-darwin9.

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

===File ~/patches/gcc-darwin-minversionalwaysdef.patch======
Index: gcc/ChangeLog
2007-02-20  Geoffrey Keating  <geoffk@apple.com>

	* config/darwin.h (LINK_SPEC): Default -mmacosx-version-min only
	if user didn't pass it.
	* config/i386/darwin.h (CC1_SPEC): Likewise.
	* config/rs6000/darwin.h (CC1_SPEC): Likewise.
	(DARWIN_MINVERSION_SPEC): Don't depend on user's setting of
	-mmacosx-version-min.

Index: gcc/testsuite/ChangeLog
2007-02-20  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/darwin-minversion-1.c: New.
	* gcc.dg/darwin-minversion-2.c: New.

Index: gcc/testsuite/gcc.dg/darwin-minversion-2.c
===================================================================
--- gcc/testsuite/gcc.dg/darwin-minversion-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/darwin-minversion-2.c	(revision 0)
@@ -0,0 +1,11 @@
+/* Basic test for -mmacosx-version-min switch on Darwin.  */
+/* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.3" } */
+/* { dg-do run { target *-*-darwin* } } */
+
+int main(void)
+{
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030
+  fail me;
+#endif
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/darwin-minversion-1.c
===================================================================
--- gcc/testsuite/gcc.dg/darwin-minversion-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/darwin-minversion-1.c	(revision 0)
@@ -0,0 +1,11 @@
+/* Basic test for -mmacosx-version-min switch on Darwin.  */
+/* { dg-options "-mmacosx-version-min=10.1" } */
+/* { dg-do run { target *-*-darwin* } } */
+
+int main(void)
+{
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010
+  fail me;
+#endif
+  return 0;
+}
Index: gcc/config/i386/darwin.h
===================================================================
--- gcc/config/i386/darwin.h	(revision 122138)
+++ gcc/config/i386/darwin.h	(working copy)
@@ -74,7 +74,7 @@
 
 #undef CC1_SPEC
 #define CC1_SPEC "%{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \
-  -mmacosx-version-min=%(darwin_minversion) \
+  %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}"
 
 #undef ASM_SPEC
Index: gcc/config/rs6000/darwin.h
===================================================================
--- gcc/config/rs6000/darwin.h	(revision 122138)
+++ gcc/config/rs6000/darwin.h	(working copy)
@@ -93,7 +93,7 @@
 #define CC1_SPEC "\
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \
   %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
-  -mmacosx-version-min=%(darwin_minversion) \
+  %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
   %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}}"
 
 #define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}"
@@ -123,8 +123,7 @@
 
 /* Determine a minimum version based on compiler options.  */
 #define DARWIN_MINVERSION_SPEC	\
-  "%{mmacosx-version-min=*:%*;	\
-     m64:10.4;			\
+  "%{m64:10.4;			\
      shared-libgcc:10.3;	\
      :10.1}"
 
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 122138)
+++ gcc/config/darwin.h	(working copy)
@@ -297,7 +297,8 @@
    %{headerpad_max_install_names*} \
    %{Zimage_base*:-image_base %*} \
    %{Zinit*:-init %*} \
-   -macosx_version_min %(darwin_minversion) \
+   %{!mmacosx-version-min=*:-macosx_version_min %(darwin_minversion)} \
+   %{mmacosx-version-min=*:-macosx_version_min %*} \
    %{nomultidefs} \
    %{Zmulti_module:-multi_module} %{Zsingle_module:-single_module} \
    %{Zmultiply_defined*:-multiply_defined %*} \
============================================================


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