diff options
author | iains <iains@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-12-11 16:23:04 +0000 |
---|---|---|
committer | iains <iains@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-12-11 16:23:04 +0000 |
commit | 5497e7a8259c93aff899efa9d59e037fc3b3c563 (patch) | |
tree | 4517238a45f388cc34b8efb9b0283ff2111fb362 | |
parent | 30ab9654d4023334c8b5f2fcc061110b7ef8bec2 (diff) | |
download | gcc-5497e7a8259c93aff899efa9d59e037fc3b3c563.tar.gz |
[Darwin] Back-port fix for PR67710.
gcc/
2016-12-11 Iain Sandoe <iain@codesourcery.com>
Backport from mainline
2016-11-27 Iain Sandoe <iain@codesourcery.com>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/67710
* config.in: Regenerate
* config/darwin-driver.c (darwin_driver_init): Emit a version string
for the assembler.
* config/darwin.h(ASM_MMACOSX_VERSION_MIN_SPEC): New, new tests.
* config/darwin.opt(asm_macosx_version_min): New.
* config/i386/darwin.h: Handle ASM_MMACOSX_VERSION_MIN_SPEC.
* configure: Regenerate
* configure.ac: Check for mmacosx-version-min handling.
gcc/testsuite/
2016-12-11 Iain Sandoe <iain@codesourcery.com>
Backport from mainline
2016-11-27 Iain Sandoe <iain@codesourcery.com>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Dominique d'Humieres <dominiq@lps.ens.fr>
PR target/67710
* gcc.dg/darwin-minversion-1.c: Update min version check.
* gcc.dg/darwin-minversion-2.c: Likewise.
* gcc.dg/darwin-minversion-3.c: Likewise.
libgcc/
2016-12-11 Iain Sandoe <iain@codesourcery.com>
Backport from mainline
2016-11-27 Iain Sandoe <iain@codesourcery.com>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/67710
* config/t-darwin: Default builds to 10.5 codegen.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@243526 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/config.in | 7 | ||||
-rw-r--r-- | gcc/config/darwin-driver.c | 28 | ||||
-rw-r--r-- | gcc/config/darwin.h | 21 | ||||
-rw-r--r-- | gcc/config/darwin.opt | 3 | ||||
-rw-r--r-- | gcc/config/i386/darwin.h | 5 | ||||
-rwxr-xr-x | gcc/configure | 39 | ||||
-rw-r--r-- | gcc/configure.ac | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/darwin-minversion-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/darwin-minversion-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/darwin-minversion-3.c | 4 | ||||
-rw-r--r-- | libgcc/ChangeLog | 9 | ||||
-rw-r--r-- | libgcc/config/t-darwin | 4 |
14 files changed, 159 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50578c8002a..56bf273cd75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,22 @@ Backport from mainline 2016-11-27 Iain Sandoe <iain@codesourcery.com> + Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR target/67710 + * config.in: Regenerate + * config/darwin-driver.c (darwin_driver_init): Emit a version string + for the assembler. + * config/darwin.h(ASM_MMACOSX_VERSION_MIN_SPEC): New, new tests. + * config/darwin.opt(asm_macosx_version_min): New. + * config/i386/darwin.h: Handle ASM_MMACOSX_VERSION_MIN_SPEC. + * configure: Regenerate + * configure.ac: Check for mmacosx-version-min handling. + +2016-12-11 Iain Sandoe <iain@codesourcery.com> + + Backport from mainline + 2016-11-27 Iain Sandoe <iain@codesourcery.com> PR target/57438 * config/i386/i386.c (ix86_code_end): Note that we emitted code diff --git a/gcc/config.in b/gcc/config.in index cda0e281587..4a70ddfa315 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -538,6 +538,13 @@ #endif +/* Define if your Mac OS X assembler supports the -mmacos-version-min option. + */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_MMACOSX_VERSION_MIN_OPTION +#endif + + /* Define if the assembler understands -mnan=. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_NAN diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index db8d72c2a81..f80c9ed2e0f 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -73,7 +73,8 @@ darwin_find_version_from_kernel (void) component. */ if (major_vers - 4 <= 4) /* On 10.4 and earlier, the old linker is used which does not - support three-component system versions. */ + support three-component system versions. + FIXME: we should not assume this - a newer linker could be used. */ asprintf (&new_flag, "10.%d", major_vers - 4); else asprintf (&new_flag, "10.%d.%s", major_vers - 4, minor_vers); @@ -294,4 +295,29 @@ darwin_driver_init (unsigned int *decoded_options_count, &(*decoded_options)[*decoded_options_count - 1]); } } + /* Create and push the major version for assemblers that need it. */ + if (vers_string != NULL) + { + char *asm_major = NULL; + char *first_period = strchr(vers_string, '.'); + if (first_period != NULL) + { + char *second_period = strchr(first_period+1, '.'); + if (second_period != NULL) + asm_major = xstrndup (vers_string, second_period-vers_string); + else + asm_major = xstrdup (vers_string); + } + /* Else we appear to have a weird macosx version with no major number. + Punt on this for now. */ + if (asm_major != NULL) + { + ++*decoded_options_count; + *decoded_options = XRESIZEVEC (struct cl_decoded_option, + *decoded_options, + *decoded_options_count); + generate_option (OPT_asm_macosx_version_min_, asm_major, 1, CL_DRIVER, + &(*decoded_options)[*decoded_options_count - 1]); + } + } } diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 3cfb876813e..990ed1883fd 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -399,10 +399,27 @@ extern GTY(()) int darwin_ms_struct; %:version-compare(>< 10.6 10.8 mmacosx-version-min= -lcrt1.10.6.o) \ %{fgnu-tm: -lcrttms.o}" -/* Default Darwin ASM_SPEC, very simple. */ +#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION +/* Emit macosx version (but only major). */ +#define ASM_MMACOSX_VERSION_MIN_SPEC \ + " %{asm_macosx_version_min=*: -mmacosx-version-min=%*} %<asm_macosx_version_min=*" +#else +#define ASM_MMACOSX_VERSION_MIN_SPEC " %<asm_macosx_version_min=*" +#endif + +/* When we detect that we're cctools or llvm as, we need to insert the right + additional options. */ +#if HAVE_GNU_AS +#define ASM_OPTIONS "" +#else +#define ASM_OPTIONS "%{v} %{w:-W} %{I*}" +#endif + +/* Default Darwin ASM_SPEC, very simple. */ #define ASM_SPEC "-arch %(darwin_arch) \ + " ASM_OPTIONS " \ %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \ - %{static}" + %{static}" ASM_MMACOSX_VERSION_MIN_SPEC /* Default ASM_DEBUG_SPEC. Darwin's as cannot currently produce dwarf debugging data. */ diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt index 7f2e394ae79..25459e07288 100644 --- a/gcc/config/darwin.opt +++ b/gcc/config/darwin.opt @@ -37,6 +37,9 @@ Driver RejectNegative Separate arch_errors_fatal Driver Alias(Zarch_errors_fatal) +asm_macosx_version_min= +Driver RejectNegative Joined + bind_at_load Driver Alias(Zbind_at_load) diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index c10ceff0cc2..705fdf2696d 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -112,8 +112,9 @@ extern int darwin_emit_branch_islands; DARWIN_CC1_SPEC #undef ASM_SPEC -#define ASM_SPEC "-arch %(darwin_arch) -force_cpusubtype_ALL \ - %{static}" +#define ASM_SPEC "-arch %(darwin_arch) \ + " ASM_OPTIONS " -force_cpusubtype_ALL \ + %{static}" ASM_MMACOSX_VERSION_MIN_SPEC #define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}" #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC diff --git a/gcc/configure b/gcc/configure index 3f91d011a8f..954673c1c43 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24463,6 +24463,45 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_lto_plugin" >&5 $as_echo "$gcc_cv_lto_plugin" >&6; } +# Target OS-specific assembler checks. + +case "$target_os" in + darwin*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mmacosx-version-min option" >&5 +$as_echo_n "checking assembler for -mmacosx-version-min option... " >&6; } +if test "${gcc_cv_as_mmacosx_version_min+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_mmacosx_version_min=no + if test x$gcc_cv_as != x; then + $as_echo '.text' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mmacosx-version-min=10.1 -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_mmacosx_version_min=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_mmacosx_version_min" >&5 +$as_echo "$gcc_cv_as_mmacosx_version_min" >&6; } +if test $gcc_cv_as_mmacosx_version_min = yes; then + +$as_echo "#define HAVE_AS_MMACOSX_VERSION_MIN_OPTION 1" >>confdefs.h + +fi + ;; +esac + +# Target CPU-specific assembler checks. + case "$target" in aarch64*-*-*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mabi option" >&5 diff --git a/gcc/configure.ac b/gcc/configure.ac index 4475e5c338e..4c65d441e72 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3652,6 +3652,20 @@ AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin, [Define to the level of your linker's plugin support.]) AC_MSG_RESULT($gcc_cv_lto_plugin) +# Target OS-specific assembler checks. + +case "$target_os" in + darwin*) + gcc_GAS_CHECK_FEATURE([-mmacosx-version-min option], + gcc_cv_as_mmacosx_version_min,, + [-mmacosx-version-min=10.1], [.text],, + [AC_DEFINE(HAVE_AS_MMACOSX_VERSION_MIN_OPTION, 1, + [Define if your Mac OS X assembler supports the -mmacos-version-min option.])]) + ;; +esac + +# Target CPU-specific assembler checks. + case "$target" in aarch64*-*-*) gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a3146c3a4b6..9ee1ead74c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -2,6 +2,18 @@ Backport from mainline 2016-11-27 Iain Sandoe <iain@codesourcery.com> + Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + Dominique d'Humieres <dominiq@lps.ens.fr> + + PR target/67710 + * gcc.dg/darwin-minversion-1.c: Update min version check. + * gcc.dg/darwin-minversion-2.c: Likewise. + * gcc.dg/darwin-minversion-3.c: Likewise. + +2016-12-11 Iain Sandoe <iain@codesourcery.com> + + Backport from mainline + 2016-11-27 Iain Sandoe <iain@codesourcery.com> PR target/57438 * gcc.dg/pr57438-1.c: New Test. diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc/testsuite/gcc.dg/darwin-minversion-1.c index 6221d617b2e..ee6493a3119 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -1,11 +1,11 @@ /* Basic test for -mmacosx-version-min switch on Darwin. */ -/* { dg-options "-mmacosx-version-min=10.1" } */ +/* { dg-options "-mmacosx-version-min=10.5" } */ /* { dg-do run { target *-*-darwin* } } */ int main () { -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1050 fail me; #endif return 0; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc/testsuite/gcc.dg/darwin-minversion-2.c index 8e18d5273a6..46fab671b95 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -1,11 +1,11 @@ /* Basic test for -mmacosx-version-min switch on Darwin. */ -/* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.3" } */ +/* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.5" } */ /* { dg-do run { target *-*-darwin* } } */ int main () { -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1050 fail me; #endif return 0; diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d1795e74a69..a2be54f490a 100644 --- a/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -1,11 +1,11 @@ /* Test that most minor versions less than 10 work. */ -/* { dg-options "-mmacosx-version-min=10.4.1" } */ +/* { dg-options "-mmacosx-version-min=10.5.8" } */ /* { dg-do compile { target *-*-darwin* } } */ int main () { -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1041 +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1058 fail me; #endif return 0; diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 848edc93712..e5645f54fa2 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2016-12-11 Iain Sandoe <iain@codesourcery.com> + + Backport from mainline + 2016-11-27 Iain Sandoe <iain@codesourcery.com> + Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR target/67710 + * config/t-darwin: Default builds to 10.5 codegen. + 2016-11-18 Walter Lee <walt@tilera.com> Backport from mainline diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin index a69169fa610..13ca6ed99d3 100644 --- a/libgcc/config/t-darwin +++ b/libgcc/config/t-darwin @@ -1,3 +1,7 @@ +# Set this as a minimum (unless overriden by arch t-files) since it's a +# reasonable lowest common denominator that works for all our archs. +HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.5 + crt3.o: $(srcdir)/config/darwin-crt3.c $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $< |