Index: ChangeLog
2007-06-06 Geoffrey Keating <geoffk@apple.com> Hui-May Chang <hm.chang@apple.com> * doc/invoke.texi (Darwin Options): Update documentation for -mmacosx-version-min. * config.gcc (*-*-darwin*): Set extra_gcc_objs. * config/darwin-driver.c: New file. * config/darwin.h (GCC_DRIVER_HOST_INITIALIZATION): New. * config/t-darwin (darwin-driver.o): New rule. * config/darwin-c.c (version_as_macro): Ignore low digit. Index: testsuite/ChangeLog 2007-06-06 Geoffrey Keating <geoffk@apple.com> * gcc.dg/darwin-minversion-3.c: New. Co-Authored-By: Hui-May Chang <hm.chang@apple.com> From-SVN: r125537
This commit is contained in:
parent
abea993f79
commit
e46b55d038
|
@ -1,3 +1,15 @@
|
||||||
|
2007-06-06 Geoffrey Keating <geoffk@apple.com>
|
||||||
|
Hui-May Chang <hm.chang@apple.com>
|
||||||
|
|
||||||
|
* doc/invoke.texi (Darwin Options): Update documentation for
|
||||||
|
-mmacosx-version-min.
|
||||||
|
* config.gcc (*-*-darwin*): Set extra_gcc_objs.
|
||||||
|
* config/darwin-driver.c: New file.
|
||||||
|
* config/darwin.h (GCC_DRIVER_HOST_INITIALIZATION): New.
|
||||||
|
* config/t-darwin (darwin-driver.o): New rule.
|
||||||
|
|
||||||
|
* config/darwin-c.c (version_as_macro): Ignore low digit.
|
||||||
|
|
||||||
2007-06-07 Uros Bizjak <ubizjak@gmail.com>
|
2007-06-07 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
* config/i386/i386.md (standard sse constant splitter): Handle TFmode.
|
* config/i386/i386.md (standard sse constant splitter): Handle TFmode.
|
||||||
|
|
|
@ -393,6 +393,7 @@ case ${target} in
|
||||||
c_target_objs="darwin-c.o"
|
c_target_objs="darwin-c.o"
|
||||||
cxx_target_objs="darwin-c.o"
|
cxx_target_objs="darwin-c.o"
|
||||||
extra_objs="darwin.o"
|
extra_objs="darwin.o"
|
||||||
|
extra_gcc_objs="darwin-driver.o"
|
||||||
default_use_cxa_atexit=yes
|
default_use_cxa_atexit=yes
|
||||||
case ${enable_threads} in
|
case ${enable_threads} in
|
||||||
"" | yes | posix) thread_file='posix' ;;
|
"" | yes | posix) thread_file='posix' ;;
|
||||||
|
|
|
@ -567,8 +567,8 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp)
|
||||||
|
|
||||||
/* Return the value of darwin_macosx_version_min suitable for the
|
/* Return the value of darwin_macosx_version_min suitable for the
|
||||||
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
|
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
|
||||||
so '10.4.2' becomes 1042.
|
so '10.4.2' becomes 1040. The lowest digit is always zero.
|
||||||
Print a warning if the version number is not known. */
|
Print a warning if the version number can't be understood. */
|
||||||
static const char *
|
static const char *
|
||||||
version_as_macro (void)
|
version_as_macro (void)
|
||||||
{
|
{
|
||||||
|
@ -579,18 +579,9 @@ version_as_macro (void)
|
||||||
if (! ISDIGIT (darwin_macosx_version_min[3]))
|
if (! ISDIGIT (darwin_macosx_version_min[3]))
|
||||||
goto fail;
|
goto fail;
|
||||||
result[2] = darwin_macosx_version_min[3];
|
result[2] = darwin_macosx_version_min[3];
|
||||||
if (darwin_macosx_version_min[4] != '\0')
|
if (darwin_macosx_version_min[4] != '\0'
|
||||||
{
|
&& darwin_macosx_version_min[4] != '.')
|
||||||
if (darwin_macosx_version_min[4] != '.')
|
goto fail;
|
||||||
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;
|
return result;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,160 @@
|
||||||
|
/* Additional functions for the GCC driver on Darwin native.
|
||||||
|
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||||
|
Contributed by Apple Computer Inc.
|
||||||
|
|
||||||
|
This file is part of GCC.
|
||||||
|
|
||||||
|
GCC is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
GCC is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#ifndef CROSS_DIRECTORY_STRUCTURE
|
||||||
|
#include "config.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "coretypes.h"
|
||||||
|
#include "tm.h"
|
||||||
|
#include "gcc.h"
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include "xregex.h"
|
||||||
|
|
||||||
|
#ifndef SWITCH_TAKES_ARG
|
||||||
|
#define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG(CHAR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WORD_SWITCH_TAKES_ARG
|
||||||
|
#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* When running on a Darwin system and using that system's headers and
|
||||||
|
libraries, default the -mmacosx-version-min flag to be the version
|
||||||
|
of the system on which the compiler is running. */
|
||||||
|
|
||||||
|
void
|
||||||
|
darwin_default_min_version (int * argc_p, char *** argv_p)
|
||||||
|
{
|
||||||
|
const int argc = *argc_p;
|
||||||
|
char ** const argv = *argv_p;
|
||||||
|
int i;
|
||||||
|
char osversion[32];
|
||||||
|
size_t osversion_len = sizeof (osversion) - 1;
|
||||||
|
static int osversion_name[2] = { CTL_KERN, KERN_OSRELEASE };
|
||||||
|
char * version_p;
|
||||||
|
char * version_pend;
|
||||||
|
int major_vers;
|
||||||
|
char minor_vers[6];
|
||||||
|
static char new_flag[sizeof ("-mmacosx-version-min=10.0.0") + 6];
|
||||||
|
|
||||||
|
/* If the command-line is empty, just return. */
|
||||||
|
if (argc <= 1)
|
||||||
|
return;
|
||||||
|
/* Don't do this if the user has specified -b or -V at the start
|
||||||
|
of the command-line. */
|
||||||
|
if (argv[1][0] == '-'
|
||||||
|
&& (argv[1][1] == 'V' ||
|
||||||
|
((argv[1][1] == 'b') && (NULL != strchr(argv[1] + 2,'-')))))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Don't do this if the user specified -mmacosx-version-min= or
|
||||||
|
-mno-macosx-version-min. */
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
if (argv[i][0] == '-')
|
||||||
|
{
|
||||||
|
const char * const p = argv[i];
|
||||||
|
if (strncmp (p, "-mno-macosx-version-min", 23) == 0
|
||||||
|
|| strncmp (p, "-mmacosx-version-min", 20) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* It doesn't count if it's an argument to a different switch. */
|
||||||
|
if (p[0] == '-'
|
||||||
|
&& ((SWITCH_TAKES_ARG (p[1]) > (p[2] != 0))
|
||||||
|
|| WORD_SWITCH_TAKES_ARG (p + 1)))
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieve the deployment target from the environment and insert
|
||||||
|
it as a flag. */
|
||||||
|
{
|
||||||
|
const char * macosx_deployment_target;
|
||||||
|
macosx_deployment_target = getenv ("MACOSX_DEPLOYMENT_TARGET");
|
||||||
|
if (macosx_deployment_target
|
||||||
|
/* Apparently, an empty string for MACOSX_DEPLOYMENT_TARGET means
|
||||||
|
"use the default". Or, possibly "use 10.1". We choose
|
||||||
|
to ignore the environment variable, as if it was never set. */
|
||||||
|
&& macosx_deployment_target[0])
|
||||||
|
{
|
||||||
|
++*argc_p;
|
||||||
|
*argv_p = xmalloc (sizeof (char *) * *argc_p);
|
||||||
|
(*argv_p)[0] = argv[0];
|
||||||
|
(*argv_p)[1] = concat ("-mmacosx-version-min=",
|
||||||
|
macosx_deployment_target, NULL);
|
||||||
|
memcpy (*argv_p + 2, argv + 1, (argc - 1) * sizeof (char *));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine the version of the running OS. If we can't, warn user,
|
||||||
|
and do nothing. */
|
||||||
|
if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
|
||||||
|
&osversion_len, NULL, 0) == -1)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "sysctl for kern.osversion failed: %s\n",
|
||||||
|
xstrerror (errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to parse the first two parts of the OS version number. Warn
|
||||||
|
user and return if it doesn't make sense. */
|
||||||
|
if (! ISDIGIT (osversion[0]))
|
||||||
|
goto parse_failed;
|
||||||
|
major_vers = osversion[0] - '0';
|
||||||
|
version_p = osversion + 1;
|
||||||
|
if (ISDIGIT (*version_p))
|
||||||
|
major_vers = major_vers * 10 + (*version_p++ - '0');
|
||||||
|
if (major_vers > 4 + 9)
|
||||||
|
goto parse_failed;
|
||||||
|
if (*version_p++ != '.')
|
||||||
|
goto parse_failed;
|
||||||
|
version_pend = strchr(version_p, '.');
|
||||||
|
if (!version_pend)
|
||||||
|
goto parse_failed;
|
||||||
|
if (! ISDIGIT (*version_p))
|
||||||
|
goto parse_failed;
|
||||||
|
strncpy(minor_vers, version_p, version_pend - version_p);
|
||||||
|
minor_vers[version_pend - version_p] = '\0';
|
||||||
|
|
||||||
|
/* The major kernel version number is 4 plus the second OS version
|
||||||
|
component. */
|
||||||
|
if (major_vers - 4 <= 4)
|
||||||
|
/* On 10.4 and earlier, the old linker is used which does not
|
||||||
|
support three-component system versions. */
|
||||||
|
sprintf (new_flag, "-mmacosx-version-min=10.%d", major_vers - 4);
|
||||||
|
else
|
||||||
|
sprintf (new_flag, "-mmacosx-version-min=10.%d.%s", major_vers - 4,
|
||||||
|
minor_vers);
|
||||||
|
|
||||||
|
/* Add the new flag. */
|
||||||
|
++*argc_p;
|
||||||
|
*argv_p = xmalloc (sizeof (char *) * *argc_p);
|
||||||
|
(*argv_p)[0] = argv[0];
|
||||||
|
(*argv_p)[1] = new_flag;
|
||||||
|
memcpy (*argv_p + 2, argv + 1, (argc - 1) * sizeof (char *));
|
||||||
|
return;
|
||||||
|
|
||||||
|
parse_failed:
|
||||||
|
fprintf (stderr, "couldn't understand kern.osversion `%.*s'\n",
|
||||||
|
(int) osversion_len, osversion);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CROSS_DIRECTORY_STRUCTURE */
|
|
@ -986,4 +986,10 @@ extern int flag_apple_kext;
|
||||||
|
|
||||||
#define TARGET_HAS_TARGETCM 1
|
#define TARGET_HAS_TARGETCM 1
|
||||||
|
|
||||||
|
#ifndef CROSS_DIRECTORY_STRUCTURE
|
||||||
|
extern void darwin_default_min_version (int * argc, char *** argv);
|
||||||
|
#define GCC_DRIVER_HOST_INITIALIZATION \
|
||||||
|
darwin_default_min_version (&argc, &argv)
|
||||||
|
#endif /* CROSS_DIRECTORY_STRUCTURE */
|
||||||
|
|
||||||
#endif /* CONFIG_DARWIN_H */
|
#endif /* CONFIG_DARWIN_H */
|
||||||
|
|
|
@ -12,6 +12,11 @@ darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
||||||
|
|
||||||
gt-darwin.h : s-gtype ; @true
|
gt-darwin.h : s-gtype ; @true
|
||||||
|
|
||||||
|
darwin-driver.o: $(srcdir)/config/darwin-driver.c \
|
||||||
|
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H)
|
||||||
|
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
|
||||||
|
$(srcdir)/config/darwin-driver.c
|
||||||
|
|
||||||
# How to build crt3.o
|
# How to build crt3.o
|
||||||
EXTRA_MULTILIB_PARTS=crt3.o
|
EXTRA_MULTILIB_PARTS=crt3.o
|
||||||
# Pass -fno-tree-dominator-opts to work around bug 26840.
|
# Pass -fno-tree-dominator-opts to work around bug 26840.
|
||||||
|
|
|
@ -8763,8 +8763,10 @@ The earliest version of MacOS X that this executable will run on
|
||||||
is @var{version}. Typical values of @var{version} include @code{10.1},
|
is @var{version}. Typical values of @var{version} include @code{10.1},
|
||||||
@code{10.2}, and @code{10.3.9}.
|
@code{10.2}, and @code{10.3.9}.
|
||||||
|
|
||||||
The default for this option is to make choices that seem to be most
|
If the compiler was built to use the system's headers by default,
|
||||||
useful.
|
then the default for this option is the system version on which the
|
||||||
|
compiler is running, otherwise the default is to make choices which
|
||||||
|
are compatible with as many systems and code bases as possible.
|
||||||
|
|
||||||
@item -mkernel
|
@item -mkernel
|
||||||
@opindex mkernel
|
@opindex mkernel
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2007-06-06 Geoffrey Keating <geoffk@apple.com>
|
||||||
|
|
||||||
|
* gcc.dg/darwin-minversion-3.c: New.
|
||||||
|
|
||||||
2007-06-07 Uros Bizjak <ubizjak@gmail.com>
|
2007-06-07 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
* gcc.target/i386/builtin-copysign.c: New test.
|
* gcc.target/i386/builtin-copysign.c: New test.
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* Test that most-minor versions greater than 9 work. */
|
||||||
|
/* { dg-options "-mmacosx-version-min=10.4.10" } */
|
||||||
|
/* { dg-do compile { target *-*-darwin* } } */
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040
|
||||||
|
fail me;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue