[Darwin,committed] There is no need to distinguish PIC/non-PIC symbol stubs.
diff mbox series

Message ID 565F57BA-A6C8-4902-BEB4-F921F4DAC8CF@sandoe.co.uk
State New
Headers show
Series
  • [Darwin,committed] There is no need to distinguish PIC/non-PIC symbol stubs.
Related show

Commit Message

Iain Sandoe Aug. 13, 2019, 7:08 p.m. UTC
As per $SUBJECT,

We can use a single flag for both pic and non-pic.
Rename this now, before a confusing name gets into the wild.

Other than the name, this is NFC.

tested on i686/powerpc/x86-64 darwin, x86_64-linux-gnu, powerpc64-linux-gnu
applied to mainline.

thanks
Iain

gcc/

2019-08-13 Iain Sandoe <iain@sandoe.co.uk>

	* 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  <iain@sandoe.co.uk>

	* 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.

Patch
diff mbox series

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 5ac092583b..fdd23c49bb 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 ab5ad03f17..93dc638f8b 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 d7e5e7bfca..7f5616cbe0 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 84afedccfb..385d253692 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 e278d9c76d..d762d3ffe3 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 fba015c426..800d7c4c4e 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 ee44236961..150dc4f4cd 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 4080c82c05..d1eb08ab19 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/obj-c++.dg/stubify-1.mm b/gcc/testsuite/obj-c++.dg/stubify-1.mm
index b82167e5e7..a32e282519 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 ee8e342c5f..69fea8def4 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 1e160a162d..641595ccfe 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 1f53b9ccb7..904ac44b25 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 ;