Commit f1c22d66 by Iain Sandoe Committed by Iain Sandoe

[Darwin, PPC] Clean up symbol stubs code.

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.

From-SVN: r276030
parent 0968003d
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.
2019-09-21 Martin Sebor <msebor@redhat.com>
PR middle-end/91830
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment