From: Iain Sandoe Date: Sun, 22 Sep 2019 19:24:14 +0000 (+0000) Subject: [Darwin, PPC] Clean up symbol stubs code. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1c22d660bc467c1816817d1240a0be5a42d1c56;p=gcc.git [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 * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 72b2151bb9d..20308790b25 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-22 Iain Sandoe + + * 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 PR middle-end/91830 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c2834bdcfe6..81aec9c54a8 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);