From d308419c64c52c2d48bdf53a65e1790a2c897e83 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Tue, 13 Aug 2019 19:03:46 +0000 Subject: [PATCH] [Darwin] There is no need to distinguish PIC/non-PIC symbol stubs. So we can use a single flag for both, and rename this now, before a confusing name gets into the wild. gcc/ 2019-08-13 Iain Sandoe * config/darwin.c (machopic_indirect_call_target): Rename symbol stub flag. (darwin_override_options): Likewise. * config/darwin.h: Likewise. * config/darwin.opt: Likewise. * config/i386/i386.c (output_pic_addr_const): Likewise. * config/rs6000/darwin.h: Likewise. * config/rs6000/rs6000.c (rs6000_call_darwin_1): Likewise. * config/i386/darwin.h (TARGET_MACHO_PICSYM_STUBS): Rename to ... ... this TARGET_MACHO_SYMBOL_STUBS. (FUNCTION_PROFILER):Likewise. * config/i386/i386.h: Likewise. gcc/testsuite/ 2019-08-13 Iain Sandoe * obj-c++.dg/stubify-1.mm: Rename symbol stub option. * obj-c++.dg/stubify-2.mm: Likewise. * objc.dg/stubify-1.m: Likewise. * objc.dg/stubify-2.m: Likewise. From-SVN: r274397 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/config/darwin.c | 12 ++++++------ gcc/config/darwin.h | 2 +- gcc/config/darwin.opt | 6 +++--- gcc/config/i386/darwin.h | 6 +++--- gcc/config/i386/i386.c | 2 +- gcc/config/i386/i386.h | 2 +- gcc/config/rs6000/darwin.h | 3 --- gcc/config/rs6000/rs6000.c | 9 +++++---- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/obj-c++.dg/stubify-1.mm | 2 +- gcc/testsuite/obj-c++.dg/stubify-2.mm | 2 +- gcc/testsuite/objc.dg/stubify-1.m | 2 +- gcc/testsuite/objc.dg/stubify-2.m | 2 +- 14 files changed, 46 insertions(+), 26 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e42fcf4..070986e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2019-08-13 Iain Sandoe + + * config/darwin.c (machopic_indirect_call_target): Rename symbol stub + flag. + (darwin_override_options): Likewise. + * config/darwin.h: Likewise. + * config/darwin.opt: Likewise. + * config/i386/i386.c (output_pic_addr_const): Likewise. + * config/rs6000/darwin.h: Likewise. + * config/rs6000/rs6000.c (rs6000_call_darwin_1): Likewise. + * config/i386/darwin.h (TARGET_MACHO_PICSYM_STUBS): Rename to ... + ... this TARGET_MACHO_SYMBOL_STUBS. + (FUNCTION_PROFILER):Likewise. + * config/i386/i386.h: Likewise. + 2019-08-13 Uroš Bizjak * config/i386/i386.md (ix86_expand_vector_extract) : diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5ac0925..fdd23c4 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -788,7 +788,7 @@ machopic_indirect_data_reference (rtx orig, rtx reg) rtx machopic_indirect_call_target (rtx target) { - if (! darwin_picsymbol_stubs) + if (! darwin_symbol_stubs) return target; if (GET_CODE (target) != MEM) @@ -3268,13 +3268,13 @@ darwin_override_options (void) Linkers that don't need stubs, don't need the EH symbol markers either. */ - if (!global_options_set.x_darwin_picsymbol_stubs) + if (!global_options_set.x_darwin_symbol_stubs) { if (darwin_target_linker) { if (strverscmp (darwin_target_linker, MIN_LD64_OMIT_STUBS) < 0) { - darwin_picsymbol_stubs = true; + darwin_symbol_stubs = true; ld_needs_eh_markers = true; } } @@ -3283,15 +3283,15 @@ darwin_override_options (void) /* If we don't know the linker version and we're targeting an old system, we know no better than to assume the use of an earlier linker. */ - darwin_picsymbol_stubs = true; + darwin_symbol_stubs = true; ld_needs_eh_markers = true; } } - else if (DARWIN_X86 && darwin_picsymbol_stubs && TARGET_64BIT) + else if (DARWIN_X86 && darwin_symbol_stubs && TARGET_64BIT) { inform (input_location, "%<-mpic-symbol-stubs%> is not required for 64b code (ignored)"); - darwin_picsymbol_stubs = false; + darwin_symbol_stubs = false; } if (generating_for_darwin_version >= 9) diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index ab5ad03..93dc638 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -1019,7 +1019,7 @@ extern void darwin_driver_init (unsigned int *,struct cl_decoded_option **); _tested_ version known to support this so far. */ #define MIN_LD64_NO_COAL_SECTS "236.4" -/* From at least version 62.1, ld64 can build PIC indirection stubs as +/* From at least version 62.1, ld64 can build symbol indirection stubs as needed, and there is no need for the compiler to emit them. */ #define MIN_LD64_OMIT_STUBS "62.1" diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt index d7e5e7b..7f5616c 100644 --- a/gcc/config/darwin.opt +++ b/gcc/config/darwin.opt @@ -75,9 +75,9 @@ mone-byte-bool Target RejectNegative Report Var(darwin_one_byte_bool) Set sizeof(bool) to 1. -mpic-symbol-stubs -Target Report Var(darwin_picsymbol_stubs) Init(0) -Force generation of PIC symbol stubs. +msymbol-stubs +Target Report Var(darwin_symbol_stubs) Init(0) +Force generation of external symbol indirection stubs. ; Some code-gen may be improved / adjusted if the linker is sufficiently modern. mtarget-linker= diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 84afedc..385d253 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -91,8 +91,8 @@ along with GCC; see the file COPYING3. If not see #define WCHAR_TYPE_SIZE 32 /* Generate pic symbol indirection stubs if this is true. */ -#undef TARGET_MACHO_PICSYM_STUBS -#define TARGET_MACHO_PICSYM_STUBS (darwin_picsymbol_stubs) +#undef TARGET_MACHO_SYMBOL_STUBS +#define TARGET_MACHO_SYMBOL_STUBS (darwin_symbol_stubs) /* For compatibility with OSX system tools, use the new style of pic stub if this is set (default). */ @@ -243,7 +243,7 @@ along with GCC; see the file COPYING3. If not see #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ do { \ - if (TARGET_MACHO_PICSYM_STUBS \ + if (TARGET_MACHO_SYMBOL_STUBS \ && MACHOPIC_INDIRECT && !TARGET_64BIT) \ { \ const char *name = machopic_mcount_stub_name (); \ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e278d9c..d762d3f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -11445,7 +11445,7 @@ output_pic_addr_const (FILE *file, rtx x, int code) break; case SYMBOL_REF: - if (TARGET_64BIT || ! TARGET_MACHO_PICSYM_STUBS) + if (TARGET_64BIT || ! TARGET_MACHO_SYMBOL_STUBS) output_addr_const (file, x); else { diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index fba015c..800d7c4 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -647,7 +647,7 @@ extern tree x86_mfence; /* Replace MACH-O, ifdefs by in-line tests, where possible. (a) Macros defined in config/i386/darwin.h */ #define TARGET_MACHO 0 -#define TARGET_MACHO_PICSYM_STUBS 0 +#define TARGET_MACHO_SYMBOL_STUBS 0 #define MACHOPIC_ATT_STUB 0 /* (b) Macros defined in config/darwin.h */ #define MACHO_DYNAMIC_NO_PIC_P 0 diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index ee44236..150dc4f 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -62,9 +62,6 @@ } \ while (0) -/* Generate pic symbol stubs if this is true. */ -extern int darwin_emit_picsym_stub; - #define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options () #define C_COMMON_OVERRIDE_OPTIONS do { \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 4080c82..d1eb08a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -12943,7 +12943,7 @@ print_operand (FILE *file, rtx x, int code) { const char *name = XSTR (x, 0); #if TARGET_MACHO - if (darwin_picsymbol_stubs + if (darwin_symbol_stubs && MACHOPIC_INDIRECT && machopic_classify_symbol (x) == MACHOPIC_UNDEFINED_FUNCTION) name = machopic_indirection_name (x, /*stub_p=*/true); @@ -19481,7 +19481,7 @@ get_prev_label (tree function_name) return NULL_TREE; } -/* Generate PIC and indirect symbol stubs. */ +/* Generate external symbol indirection stubs (PIC and non-PIC). */ void machopic_output_stub (FILE *file, const char *symb, const char *stub) @@ -24523,8 +24523,9 @@ rs6000_call_darwin_1 (rtx value, rtx func_desc, rtx tlsarg, if ((cookie_val & CALL_LONG) != 0 && GET_CODE (func_desc) == SYMBOL_REF) { - /* FIXME: the longcall opt should not hang off picsymbol stubs. */ - if (darwin_picsymbol_stubs && TARGET_32BIT) + /* FIXME: the longcall opt should not hang off this flag, it is most + likely incorrect for kernel-mode code-generation. */ + if (darwin_symbol_stubs && TARGET_32BIT) make_island = true; /* Do nothing yet, retain the CALL_LONG flag. */ else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4514664..5857709 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-08-13 Iain Sandoe + + * obj-c++.dg/stubify-1.mm: Rename symbol stub option. + * obj-c++.dg/stubify-2.mm: Likewise. + * objc.dg/stubify-1.m: Likewise. + * objc.dg/stubify-2.m: Likewise. + 2013-08-13 Thomas Koenig PR fortran/90563 diff --git a/gcc/testsuite/obj-c++.dg/stubify-1.mm b/gcc/testsuite/obj-c++.dg/stubify-1.mm index b82167e..a32e282 100644 --- a/gcc/testsuite/obj-c++.dg/stubify-1.mm +++ b/gcc/testsuite/obj-c++.dg/stubify-1.mm @@ -4,7 +4,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-Os -mdynamic-no-pic -fno-exceptions -mmacosx-version-min=10.4 -mpic-symbol-stubs" } */ +/* { dg-options "-Os -mdynamic-no-pic -fno-exceptions -mmacosx-version-min=10.4 -msymbol-stubs" } */ typedef struct objc_object { } *id ; int x = 41 ; diff --git a/gcc/testsuite/obj-c++.dg/stubify-2.mm b/gcc/testsuite/obj-c++.dg/stubify-2.mm index ee8e342..69fea8d 100644 --- a/gcc/testsuite/obj-c++.dg/stubify-2.mm +++ b/gcc/testsuite/obj-c++.dg/stubify-2.mm @@ -4,7 +4,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -mpic-symbol-stubs" } */ +/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -msymbol-stubs" } */ typedef struct objc_object { } *id ; int x = 41 ; diff --git a/gcc/testsuite/objc.dg/stubify-1.m b/gcc/testsuite/objc.dg/stubify-1.m index 1e160a1..641595c 100644 --- a/gcc/testsuite/objc.dg/stubify-1.m +++ b/gcc/testsuite/objc.dg/stubify-1.m @@ -4,7 +4,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-Os -mdynamic-no-pic -mmacosx-version-min=10.4 -mpic-symbol-stubs" } */ +/* { dg-options "-Os -mdynamic-no-pic -mmacosx-version-min=10.4 -msymbol-stubs" } */ typedef struct objc_object { } *id ; int x = 41 ; diff --git a/gcc/testsuite/objc.dg/stubify-2.m b/gcc/testsuite/objc.dg/stubify-2.m index 1f53b9c..904ac44 100644 --- a/gcc/testsuite/objc.dg/stubify-2.m +++ b/gcc/testsuite/objc.dg/stubify-2.m @@ -4,7 +4,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -mpic-symbol-stubs" } */ +/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -msymbol-stubs" } */ typedef struct objc_object { } *id ; int x = 41 ; -- 2.7.4