aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog32
-rw-r--r--gcc/config.gcc18
-rw-r--r--gcc/config.in7
-rw-r--r--gcc/config/darwin-c.c54
-rw-r--r--gcc/config/darwin-protos.h3
-rw-r--r--gcc/config/darwin.h19
-rw-r--r--gcc/config/darwin.opt12
-rw-r--r--gcc/config/i386/darwin.h3
-rw-r--r--gcc/config/rs6000/darwin.h10
-rw-r--r--gcc/config/rs6000/darwin7.h (renamed from gcc/config/darwin7.h)14
-rw-r--r--gcc/config/rs6000/darwin8.h (renamed from gcc/config/darwin8.h)11
-rwxr-xr-xgcc/configure6
-rw-r--r--gcc/configure.ac5
-rw-r--r--gcc/doc/invoke.texi11
-rw-r--r--gcc/gcc.c125
-rw-r--r--gcc/testsuite/ChangeLog13
-rw-r--r--gcc/testsuite/gcc.dg/builtins-18.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtins-20.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtins-53.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtins-config.h9
-rw-r--r--gcc/testsuite/gcc.dg/darwin-version-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-convert-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-convert-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-convert-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-power-1.c1
25 files changed, 319 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b61d62d0..1c2d6b9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,35 @@
+2005-07-07 Geoffrey Keating <geoffk@apple.com>
+
+ * config.gcc (*-*-darwin*): Only one target-specific header file
+ for generic darwin.
+ (powerpc-*-darwin*): Add version-specific header files.
+ * configure.in (gcc_AC_CHECK_DECLS): Add strverscmp.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * gcc.c: Include xregex.h.
+ (version_compare_spec_function): New.
+ (spec_function): Add version-compare.
+ (replace_outfile_spec_function): Reformat comment.
+ (compare_version_strings): New.
+ * config/darwin-c.c (version_as_macro): New.
+ (builtin_define): New.
+ (darwin_cpp_builtins): New.
+ * config/darwin-protos.h (darwin_cpp_builtins): New.
+ * config/darwin.h (CPP_SPEC): Don't define APPLE_CC here.
+ (LIB_SPEC): Make unconditional, update comment.
+ (TARGET_C99_FUNCTIONS): Define.
+ * config/darwin.opt: Sort.
+ (mmacosx-version-min=): New.
+ * config/darwin7.h: Delete.
+ * config/darwin8.h: Delete.
+ * config/i386/darwin.h (): Call darwin_cpp_builtins.
+ * config/rs6000/darwin.h (): Call darwin_cpp_builtins.
+ (TARGET_C99_FUNCTIONS): Define.
+ * config/rs6000/darwin7.h: New.
+ * config/rs6000/darwin8.h: New.
+ * doc/invoke.texi (Darwin Options): Add -mmacosx-version-min=
+ (-mmacosx-version-min): Document.
+
2005-07-07 Ian Lance Taylor <ian@airs.com>
* config/mips/mips.md (abs<mode>2) [GPR]: Remove.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 66cced2..4119abb 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -355,12 +355,6 @@ esac
# Common parts for widely ported systems.
case ${target} in
*-*-darwin*)
- case ${target} in
- *-darwin1[0-9]*) tm_file="${tm_file} darwin8.h" ;;
- *-darwin[0-6]*) ;;
- *-darwin7*) tm_file="${tm_file} darwin7.h" ;;
- *) tm_file="${tm_file} darwin8.h" ;;
- esac
tm_file="${tm_file} darwin.h"
tm_p_file="${tm_p_file} darwin-protos.h"
tmake_file="t-darwin t-slibgcc-darwin"
@@ -1608,9 +1602,15 @@ powerpc-*-darwin*)
tmake_file="${tmake_file} rs6000/t-darwin"
extra_options="${extra_options} rs6000/darwin.opt"
case ${target} in
- *-darwin1[0-9]*) tmake_file="${tmake_file} rs6000/t-darwin8" ;;
- *-darwin[0-7]*) ;;
- *-darwin[8-9]*) tmake_file="${tmake_file} rs6000/t-darwin8" ;;
+ *-darwin1[0-9]* | *-darwin[8-9]*)
+ tmake_file="${tmake_file} rs6000/t-darwin8"
+ tm_file="${tm_file} rs6000/darwin8.h"
+ ;;
+ *-darwin7*)
+ tm_file="${tm_file} rs6000/darwin7.h"
+ ;;
+ *-darwin[0-6]*)
+ ;;
esac
extra_headers=altivec.h
;;
diff --git a/gcc/config.in b/gcc/config.in
index 192b461..3fc2f58 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -577,6 +577,13 @@
#endif
+/* Define to 1 if we found a declaration for 'strverscmp', otherwise define to
+ 0. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_DECL_STRVERSCMP
+#endif
+
+
/* Define to 1 if we found a declaration for 'times', otherwise define to 0.
*/
#ifndef USED_FOR_TARGET
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 9102ea2..738f07c 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -542,3 +542,57 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp)
return 0;
}
+
+/* Return the value of darwin_macosx_version_min suitable for the
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
+ so '10.4.2' becomes 1042.
+ Print a warning if the version number is not known. */
+static const char *
+version_as_macro (void)
+{
+ static char result[] = "1000";
+
+ if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
+ goto fail;
+ if (! ISDIGIT (darwin_macosx_version_min[3]))
+ goto fail;
+ result[2] = darwin_macosx_version_min[3];
+ if (darwin_macosx_version_min[4] != '\0')
+ {
+ if (darwin_macosx_version_min[4] != '.')
+ goto fail;
+ if (! ISDIGIT (darwin_macosx_version_min[5]))
+ goto fail;
+ if (darwin_macosx_version_min[6] != '\0')
+ goto fail;
+ result[3] = darwin_macosx_version_min[5];
+ }
+ else
+ result[3] = '0';
+
+ return result;
+
+ fail:
+ error ("Unknown value %qs of -mmacosx-version-min",
+ darwin_macosx_version_min);
+ return "1000";
+}
+
+/* Define additional CPP flags for Darwin. */
+
+#define builtin_define(TXT) cpp_define (pfile, TXT)
+
+void
+darwin_cpp_builtins (cpp_reader *pfile)
+{
+ builtin_define ("__MACH__");
+ builtin_define ("__APPLE__");
+
+ /* __APPLE_CC__ is defined as some old Apple include files expect it
+ to be defined and won't work if it isn't. */
+ builtin_define_with_value ("__APPLE_CC__", "1", false);
+
+ if (darwin_macosx_version_min)
+ builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__",
+ version_as_macro(), false);
+}
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index c3a03e2..dfada76 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -1,5 +1,5 @@
/* Prototypes.
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
@@ -135,3 +135,4 @@ extern void darwin_assemble_visibility (tree, int);
extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,
const char *);
extern bool darwin_binds_local_p (tree);
+extern void darwin_cpp_builtins (struct cpp_reader *);
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 022e3a0..9802fe4 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -185,13 +185,11 @@ Boston, MA 02110-1301, USA. */
!strcmp (STR, "dylinker_install_name") ? 1 : \
0)
-/* Machine dependent cpp options. __APPLE_CC__ is defined as the
- Apple include files expect it to be defined and won't work if it
- isn't. */
+/* Machine dependent cpp options. Don't add more options here, add
+ them to darwin_cpp_builtins in darwin-c.c. */
#undef CPP_SPEC
-#define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}\
- -D__APPLE_CC__=1"
+#define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}"
/* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus
precomp, libtool, and fat build additions. Also we
@@ -291,12 +289,9 @@ Boston, MA 02110-1301, USA. */
%{dylinker} %{Mach} "
-/* Machine dependent libraries but do not redefine it if we already on 7.0 and
- above as it needs to link with libmx also. */
+/* Machine dependent libraries. */
-#ifndef LIB_SPEC
#define LIB_SPEC "%{!static:-lSystem}"
-#endif
/* -dynamiclib implies -shared-libgcc just like -shared would on linux. */
#define REAL_LIBGCC_SPEC \
@@ -1033,10 +1028,8 @@ void add_framework_path (char *);
#define TARGET_HAS_F_SETLKW
-/* Darwin before 7.0 does not have C99 functions. */
-#ifndef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 0
-#endif
+/* All new versions of Darwin have C99 functions. */
+#define TARGET_C99_FUNCTIONS
#define WINT_TYPE "int"
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index 84f4149..90a094b 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -19,10 +19,14 @@
; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
; 02110-1301, USA.
-mone-byte-bool
-Target RejectNegative Report Var(darwin_one_byte_bool)
-Set sizeof(bool) to 1
-
mfix-and-continue
Target Report Var(darwin_fix_and_continue)
Generate code suitable for fast turn around debugging
+
+mmacosx-version-min=
+Target Joined Report Var(darwin_macosx_version_min)
+The earliest MacOS X version on which this program will run
+
+mone-byte-bool
+Target RejectNegative Report Var(darwin_one_byte_bool)
+Set sizeof(bool) to 1
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 348c42b..7e8b2dc 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -33,8 +33,7 @@ Boston, MA 02110-1301, USA. */
{ \
builtin_define ("__i386__"); \
builtin_define ("__LITTLE_ENDIAN__"); \
- builtin_define ("__MACH__"); \
- builtin_define ("__APPLE__"); \
+ darwin_cpp_builtins (pfile); \
} \
while (0)
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 72ec64b..6086445 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -54,8 +54,7 @@
if (TARGET_64BIT) builtin_define ("__ppc64__"); \
builtin_define ("__POWERPC__"); \
builtin_define ("__NATURAL_ALIGNMENT__"); \
- builtin_define ("__MACH__"); \
- builtin_define ("__APPLE__"); \
+ darwin_cpp_builtins (pfile); \
} \
while (0)
@@ -415,3 +414,10 @@ do { \
/* This is the reserved ivar address Objective-C. */
#define OFFS_ASSIGNIVAR_FAST 0xFFFEFEC0
+
+/* Old versions of Mac OS/Darwin don't have C99 functions available. */
+#undef TARGET_C99_FUNCTIONS
+#define TARGET_C99_FUNCTIONS \
+ (TARGET_64BIT \
+ || (darwin_macosx_version_min \
+ && strverscmp (darwin_macosx_version_min, "10.3") >= 0))
diff --git a/gcc/config/darwin7.h b/gcc/config/rs6000/darwin7.h
index 1932881..4c1cda3 100644
--- a/gcc/config/darwin7.h
+++ b/gcc/config/rs6000/darwin7.h
@@ -19,11 +19,13 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* Darwin 7.0 and above have C99 functions. */
-#define TARGET_C99_FUNCTIONS 1
-
-/* Machine dependent libraries, include libmx when compiling on Darwin 7.0
- and above. */
+/* Machine dependent libraries. Include libmx when compiling for
+ Darwin 7.0 and above, but before libSystem, since the functions are
+ actually in libSystem but for 7.x compatibility we want them to be
+ looked for in libmx first. Include libmx by default because otherwise
+ libstdc++ isn't usable. */
#undef LIB_SPEC
-#define LIB_SPEC "%{!static:-lSystem -lmx}"
+#define LIB_SPEC "%{!static:\
+ %:version-compare(!< 10.3 mmacosx-version-min= -lmx)\
+ -lSystem}"
diff --git a/gcc/config/darwin8.h b/gcc/config/rs6000/darwin8.h
index f4e0d82..ee583a2 100644
--- a/gcc/config/darwin8.h
+++ b/gcc/config/rs6000/darwin8.h
@@ -19,16 +19,15 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* Darwin 7.0 and above have C99 functions. */
-#define TARGET_C99_FUNCTIONS 1
-
/* Machine dependent libraries. Include libmx when compiling on
Darwin 7.0 and above, but before libSystem, since the functions are
actually in libSystem but for 7.x compatibility we want them to be
- looked for in libmx first. Include libSystemStubs when compiling
- on 8.0 and above and not 64-bit long double. */
+ looked for in libmx first---but only do this if 7.x compatibility
+ is a concern, which it's not in 64-bit mode. Include
+ libSystemStubs when compiling on (not necessarily for) 8.0 and
+ above and not 64-bit long double. */
#undef LIB_SPEC
#define LIB_SPEC "%{!static:\
%{!mlong-double-64:%{pg:-lSystemStubs_profile;:-lSystemStubs}} \
- -lmx -lSystem}"
+ %{!m64:%:version-compare(>< 10.3 10.4 mmacosx-version-min= -lmx)} -lSystem}"
diff --git a/gcc/configure b/gcc/configure
index 55015f6..fd89fc8 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11212,8 +11212,10 @@ CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
-for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd strsignal \
- strstr errno snprintf vsnprintf vasprintf malloc realloc calloc \
+
+for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
+ strsignal strstr strverscmp \
+ errno snprintf vsnprintf vasprintf malloc realloc calloc \
free basename getopt clock getpagesize clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked
do
ac_tr_decl=`echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
diff --git a/gcc/configure.ac b/gcc/configure.ac
index f2d631b..00a531f 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1049,8 +1049,9 @@ AM_LANGINFO_CODESET
# We will need to find libiberty.h and ansidecl.h
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
-gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd strsignal \
- strstr errno snprintf vsnprintf vasprintf malloc realloc calloc \
+gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
+ strsignal strstr strverscmp \
+ errno snprintf vsnprintf vasprintf malloc realloc calloc \
free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
#include "ansidecl.h"
#include "system.h"])
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a36f179..8acfd0f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -451,7 +451,8 @@ Objective-C and Objective-C++ Dialects}.
-single_module -static -sub_library -sub_umbrella @gol
-twolevel_namespace -umbrella -undefined @gol
-unexported_symbols_list -weak_reference_mismatches @gol
--whatsloaded -F -gused -gfull -mone-byte-bool}
+-whatsloaded -F -gused -gfull -mmacosx-min-version=@var{version} @gol
+-mone-byte-bool}
@emph{DEC Alpha Options}
@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
@@ -7668,6 +7669,14 @@ This is by default ON@.
@opindex -gfull
Emit debugging information for all symbols and types.
+@item -mmacosx-version-min=@var{version}
+The earliest version of MacOS X that this executable will run on
+is @var{version}. Typical values of @var{version} include @code{10.1},
+@code{10.2}, and @code{10.3.9}.
+
+The default for this option is to make choices that seem to be most
+useful.
+
@item -mone-byte-bool
@opindex -mone-byte-bool
Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 1530fc0..c137ad4 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -80,6 +80,7 @@ compilation is specified by a string called a "spec". */
#if ! defined( SIGCHLD ) && defined( SIGCLD )
# define SIGCHLD SIGCLD
#endif
+#include "xregex.h"
#include "obstack.h"
#include "intl.h"
#include "prefix.h"
@@ -349,6 +350,7 @@ static const char *convert_filename (const char *, int, int);
static const char *if_exists_spec_function (int, const char **);
static const char *if_exists_else_spec_function (int, const char **);
static const char *replace_outfile_spec_function (int, const char **);
+static const char *version_compare_spec_function (int, const char **);
/* The Specs Language
@@ -1577,6 +1579,7 @@ static const struct spec_function static_spec_functions[] =
{ "if-exists", if_exists_spec_function },
{ "if-exists-else", if_exists_else_spec_function },
{ "replace-outfile", replace_outfile_spec_function },
+ { "version-compare", version_compare_spec_function },
{ 0, 0 }
};
@@ -7573,8 +7576,9 @@ if_exists_else_spec_function (int argc, const char **argv)
}
/* replace-outfile built-in spec function.
- This looks for the first argument in the outfiles array's name and replaces it
- with the second argument. */
+
+ This looks for the first argument in the outfiles array's name and
+ replaces it with the second argument. */
static const char *
replace_outfile_spec_function (int argc, const char **argv)
@@ -7592,3 +7596,120 @@ replace_outfile_spec_function (int argc, const char **argv)
return NULL;
}
+/* Given two version numbers, compares the two numbers.
+ A version number must match the regular expression
+ ([1-9][0-9]*|0)(\.([1-9][0-9]*|0))*
+*/
+static int
+compare_version_strings (const char *v1, const char *v2)
+{
+ int rresult;
+ regex_t r;
+
+ if (regcomp (&r, "^([1-9][0-9]*|0)(\\.([1-9][0-9]*|0))*$",
+ REG_EXTENDED | REG_NOSUB) != 0)
+ abort ();
+ rresult = regexec (&r, v1, 0, NULL, 0);
+ if (rresult == REG_NOMATCH)
+ fatal ("invalid version number `%s'", v1);
+ else if (rresult != 0)
+ abort ();
+ rresult = regexec (&r, v2, 0, NULL, 0);
+ if (rresult == REG_NOMATCH)
+ fatal ("invalid version number `%s'", v2);
+ else if (rresult != 0)
+ abort ();
+
+ return strverscmp (v1, v2);
+}
+
+
+/* version_compare built-in spec function.
+
+ This takes an argument of the following form:
+
+ <comparison-op> <arg1> [<arg2>] <switch> <result>
+
+ and produces "result" if the comparison evaluates to true,
+ and nothing if it doesn't.
+
+ The supported <comparison-op> values are:
+
+ >= true if switch is a later (or same) version than arg1
+ !> opposite of >=
+ < true if switch is an earlier version than arg1
+ !< opposite of <
+ >< true if switch is arg1 or later, and earlier than arg2
+ <> true if switch is earlier than arg1 or is arg2 or later
+
+ If the switch is not present, the condition is false unless
+ the first character of the <comparison-op> is '!'.
+
+ For example,
+ %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
+ adds -lmx if -mmacosx-version-min=10.3.9 was passed. */
+
+static const char *
+version_compare_spec_function (int argc, const char **argv)
+{
+ int comp1, comp2;
+ size_t switch_len;
+ const char *switch_value = NULL;
+ int nargs = 1, i;
+ bool result;
+
+ if (argc < 3)
+ abort ();
+ if (argv[0][0] == '\0')
+ abort ();
+ if ((argv[0][1] == '<' || argv[0][1] == '>') && argv[0][0] != '!')
+ nargs = 2;
+ if (argc != nargs + 3)
+ abort ();
+
+ switch_len = strlen (argv[nargs + 1]);
+ for (i = 0; i < n_switches; i++)
+ if (!strncmp (switches[i].part1, argv[nargs + 1], switch_len)
+ && check_live_switch (i, switch_len))
+ switch_value = switches[i].part1 + switch_len;
+
+ if (switch_value == NULL)
+ comp1 = comp2 = -1;
+ else
+ {
+ comp1 = compare_version_strings (switch_value, argv[1]);
+ if (nargs == 2)
+ comp2 = compare_version_strings (switch_value, argv[2]);
+ else
+ comp2 = -1; /* This value unused. */
+ }
+
+ switch (argv[0][0] << 8 | argv[0][1])
+ {
+ case '>' << 8 | '=':
+ result = comp1 >= 0;
+ break;
+ case '!' << 8 | '<':
+ result = comp1 >= 0 || switch_value == NULL;
+ break;
+ case '<' << 8:
+ result = comp1 < 0;
+ break;
+ case '!' << 8 | '>':
+ result = comp1 < 0 || switch_value == NULL;
+ break;
+ case '>' << 8 | '<':
+ result = comp1 >= 0 && comp2 < 0;
+ break;
+ case '<' << 8 | '>':
+ result = comp1 < 0 || comp2 >= 0;
+ break;
+
+ default:
+ abort ();
+ }
+ if (! result)
+ return NULL;
+
+ return argv[nargs + 2];
+}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 394b846..67c70d4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2005-07-07 Geoffrey Keating <geoffk@apple.com>
+
+ * gcc.dg/darwin-version-1.c: New.
+ * gcc.dg/builtins-18.c: On Darwin, needs -mmacosx-version-min=10.3.
+ * gcc.dg/builtins-20.c: Likewise.
+ * gcc.dg/builtins-53.c: Likewise.
+ * gcc.dg/torture/builtins-convert-1.c: Likewise.
+ * gcc.dg/torture/builtins-convert-2.c: Likewise.
+ * gcc.dg/torture/builtins-convert-3.c: Likewise.
+ * gcc.dg/torture/builtins-power-1.c: Likewise.
+ * gcc.dg/builtins-config.h: Complain if macosx-version-min not set
+ on Darwin.
+
2005-07-07 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/vrp17.c: Simplify. Remove dependency on
diff --git a/gcc/testsuite/gcc.dg/builtins-18.c b/gcc/testsuite/gcc.dg/builtins-18.c
index a47de8b..d04fe71 100644
--- a/gcc/testsuite/gcc.dg/builtins-18.c
+++ b/gcc/testsuite/gcc.dg/builtins-18.c
@@ -7,6 +7,7 @@
/* { dg-do link } */
/* { dg-options "-O2 -ffast-math" } */
+/* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c
index fb7dd95..dbcf96c3 100644
--- a/gcc/testsuite/gcc.dg/builtins-20.c
+++ b/gcc/testsuite/gcc.dg/builtins-20.c
@@ -7,6 +7,7 @@
/* { dg-do link } */
/* { dg-options "-O2 -ffast-math" } */
+/* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/builtins-53.c b/gcc/testsuite/gcc.dg/builtins-53.c
index e01908c..2b4b2f9 100644
--- a/gcc/testsuite/gcc.dg/builtins-53.c
+++ b/gcc/testsuite/gcc.dg/builtins-53.c
@@ -10,6 +10,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math" } */
+/* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/builtins-config.h b/gcc/testsuite/gcc.dg/builtins-config.h
index 05afc5e..74915bc 100644
--- a/gcc/testsuite/gcc.dg/builtins-config.h
+++ b/gcc/testsuite/gcc.dg/builtins-config.h
@@ -19,6 +19,15 @@
/* FreeBSD before version 5 doesn't have the entire C99 runtime. */
#elif defined(__netware__)
/* NetWare doesn't have the entire C99 runtime. */
+#elif (defined(__APPLE__) \
+ && ! defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__))
+/* MacOS versions before 10.3 don't have many C99 functions.
+ But, if you're including this file, you probably want to test the
+ newer behaviour, so: */
+#error forgot to set -mmacosx-version-min.
+#elif (defined(__APPLE__) \
+ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1030)
+/* MacOS versions before 10.3 don't have many C99 functions. */
#else
/* Newlib has the "f" variants of the math functions, but not the "l"
variants. TARGET_C99_FUNCTIONS is only defined if all C99
diff --git a/gcc/testsuite/gcc.dg/darwin-version-1.c b/gcc/testsuite/gcc.dg/darwin-version-1.c
new file mode 100644
index 0000000..11cfcef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/darwin-version-1.c
@@ -0,0 +1,10 @@
+/* Basic test of the -mmacosx-version-min option. */
+
+/* { dg-options "-mmacosx-version-min=10.1" } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c b/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
index ac67159..d9fa77b 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
@@ -7,6 +7,7 @@
/* { dg-do link } */
/* { dg-options "-ffast-math" } */
+/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "../builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-convert-2.c b/gcc/testsuite/gcc.dg/torture/builtin-convert-2.c
index 68fc071..5c4c4a6 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-convert-2.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-convert-2.c
@@ -7,6 +7,7 @@
/* { dg-do link } */
/* { dg-options "-ffast-math" } */
+/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "../builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-convert-3.c b/gcc/testsuite/gcc.dg/torture/builtin-convert-3.c
index 9901cec..4efabd5 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-convert-3.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-convert-3.c
@@ -7,6 +7,7 @@
/* { dg-do link } */
/* { dg-options "-ffast-math" } */
+/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "../builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-power-1.c b/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
index 7b890bb..bbee067 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
@@ -7,6 +7,7 @@
/* { dg-do link } */
/* { dg-options "-ffast-math" } */
+/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
#include "../builtins-config.h"