diff mbox series

[Darwin,PPC,committed] Clean up symbol stubs code.

Message ID 05E07387-25E6-484A-B622-0D96F7B76E0D@sandoe.co.uk
State New
Headers show
Series [Darwin,PPC,committed] Clean up symbol stubs code. | expand

Commit Message

Iain Sandoe Sept. 22, 2019, 7:28 p.m. UTC
Hi,

Some tidy-ups I came across whilst looking for a real bug …

Remove dead code for the the TARGET_LINK_STACK which is not
applicable to Darwin. Use MACHOPIC_PURE instead of a hard-wired
PIC level to determine the stub kind.

Merge common code blocks.

gcc/ChangeLog:

2019-09-22  Iain Sandoe  <iain@sandoe.co.uk>

	* config/rs6000/rs6000.c (machopic_output_stub): Remove dead
	code.  Merge code blocks with common conditionals. Use declared
	macro instead of a magic number for PIC level.
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c2834bdcfe..81aec9c54a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -19499,7 +19499,6 @@  machopic_output_stub (FILE *file, const char *symb, const char *stub)
   /* Lose our funky encoding stuff so it doesn't contaminate the stub.  */
   symb = (*targetm.strip_name_encoding) (symb);
 
-
   length = strlen (symb);
   symbol_name = XALLOCAVEC (char, length + 32);
   GEN_SYMBOL_NAME_FOR_SYMBOL (symbol_name, symb, length);
@@ -19507,13 +19506,9 @@  machopic_output_stub (FILE *file, const char *symb, const char *stub)
   lazy_ptr_name = XALLOCAVEC (char, length + 32);
   GEN_LAZY_PTR_NAME_FOR_SYMBOL (lazy_ptr_name, symb, length);
 
-  if (flag_pic == 2)
-    switch_to_section (darwin_sections[machopic_picsymbol_stub1_section]);
-  else
-    switch_to_section (darwin_sections[machopic_symbol_stub1_section]);
-
-  if (flag_pic == 2)
+  if (MACHOPIC_PURE)
     {
+      switch_to_section (darwin_sections[machopic_picsymbol_stub1_section]);
       fprintf (file, "\t.align 5\n");
 
       fprintf (file, "%s:\n", stub);
@@ -19524,18 +19519,8 @@  machopic_output_stub (FILE *file, const char *symb, const char *stub)
       sprintf (local_label_0, "L%u$spb", label);
 
       fprintf (file, "\tmflr r0\n");
-      if (TARGET_LINK_STACK)
-       {
-         char name[32];
-         get_ppc476_thunk_name (name);
-         fprintf (file, "\tbl %s\n", name);
-         fprintf (file, "%s:\n\tmflr r11\n", local_label_0);
-       }
-      else
-       {
-         fprintf (file, "\tbcl 20,31,%s\n", local_label_0);
-         fprintf (file, "%s:\n\tmflr r11\n", local_label_0);
-       }
+      fprintf (file, "\tbcl 20,31,%s\n", local_label_0);
+      fprintf (file, "%s:\n\tmflr r11\n", local_label_0);
       fprintf (file, "\taddis r11,r11,ha16(%s-%s)\n",
               lazy_ptr_name, local_label_0);
       fprintf (file, "\tmtlr r0\n");
@@ -19545,8 +19530,9 @@  machopic_output_stub (FILE *file, const char *symb, const char *stub)
       fprintf (file, "\tmtctr r12\n");
       fprintf (file, "\tbctr\n");
     }
-  else
+  else /* mdynamic-no-pic or mkernel.  */
     {
+      switch_to_section (darwin_sections[machopic_symbol_stub1_section]);
       fprintf (file, "\t.align 4\n");
 
       fprintf (file, "%s:\n", stub);