From 71625f3dc600a9b363a02c996269a7e97d11c841 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 10 Jun 2005 01:44:59 +0000 Subject: [PATCH] linux.h (NO_PROFILE_COUNTERS): Define. * config/rs6000/linux.h (NO_PROFILE_COUNTERS): Define. * config/rs6000/linux64.h (NO_PROFILE_COUNTERS): Define as 1. * config/rs6000/rs6000.c (output_function_profiler): Obey NO_PROFILE_COUNTERS. Handle TARGET_SECURE_PLT. Use "bcl 20,31" for -fPIC. Delete save_lr and substitute its value into strings. From-SVN: r100814 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/linux.h | 5 ++++- gcc/config/rs6000/linux64.h | 2 +- gcc/config/rs6000/rs6000.c | 35 +++++++++++++++++++++++++---------- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b91d5d064bf..b1fc45c604d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-06-10 Alan Modra + + * config/rs6000/linux.h (NO_PROFILE_COUNTERS): Define. + * config/rs6000/linux64.h (NO_PROFILE_COUNTERS): Define as 1. + * config/rs6000/rs6000.c (output_function_profiler): Obey + NO_PROFILE_COUNTERS. Handle TARGET_SECURE_PLT. Use "bcl 20,31" + for -fPIC. Delete save_lr and substitute its value into strings. + 2005-06-09 Dale Johannesen * config/i386/i386.c (optimization_options): Make -fno-math-errno diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h index e35f03347e1..c7edf500a7e 100644 --- a/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for PowerPC machines running Linux. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Michael Meissner (meissner@cygnus.com). @@ -28,6 +28,9 @@ process. */ #define OS_MISSING_POWERPC64 1 +/* We use glibc _mcount for profiling. */ +#define NO_PROFILE_COUNTERS 1 + /* glibc has float and long double forms of math functions. */ #undef TARGET_C99_FUNCTIONS #define TARGET_C99_FUNCTIONS 1 diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index d2ab9bf65ae..29e182522f8 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -207,7 +207,7 @@ extern int dot_symbols; #endif /* We use glibc _mcount for profiling. */ -#define NO_PROFILE_COUNTERS TARGET_64BIT +#define NO_PROFILE_COUNTERS 1 #define PROFILE_HOOK(LABEL) \ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5aa2558d0fb..95ed9e0b34e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -15433,7 +15433,6 @@ void output_function_profiler (FILE *file, int labelno) { char buf[100]; - int save_lr = 8; switch (DEFAULT_ABI) { @@ -15441,7 +15440,6 @@ output_function_profiler (FILE *file, int labelno) gcc_unreachable (); case ABI_V4: - save_lr = 4; if (!TARGET_32BIT) { warning (0, "no profiling of 64-bit code for this ABI"); @@ -15449,11 +15447,28 @@ output_function_profiler (FILE *file, int labelno) } ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno); fprintf (file, "\tmflr %s\n", reg_names[0]); - if (flag_pic == 1) + if (NO_PROFILE_COUNTERS) + { + asm_fprintf (file, "\t{st|stw} %s,4(%s)\n", + reg_names[0], reg_names[1]); + } + else if (TARGET_SECURE_PLT && flag_pic) + { + asm_fprintf (file, "\tbcl 20,31,1f\n1:\n\t{st|stw} %s,4(%s)\n", + reg_names[0], reg_names[1]); + asm_fprintf (file, "\tmflr %s\n", reg_names[12]); + asm_fprintf (file, "\t{cau|addis} %s,%s,", + reg_names[12], reg_names[12]); + assemble_name (file, buf); + asm_fprintf (file, "-1b@ha\n\t{cal|la} %s,", reg_names[0]); + assemble_name (file, buf); + asm_fprintf (file, "-1b@l(%s)\n", reg_names[12]); + } + else if (flag_pic == 1) { fputs ("\tbl _GLOBAL_OFFSET_TABLE_@local-4\n", file); - asm_fprintf (file, "\t{st|stw} %s,%d(%s)\n", - reg_names[0], save_lr, reg_names[1]); + asm_fprintf (file, "\t{st|stw} %s,4(%s)\n", + reg_names[0], reg_names[1]); asm_fprintf (file, "\tmflr %s\n", reg_names[12]); asm_fprintf (file, "\t{l|lwz} %s,", reg_names[0]); assemble_name (file, buf); @@ -15461,10 +15476,10 @@ output_function_profiler (FILE *file, int labelno) } else if (flag_pic > 1) { - asm_fprintf (file, "\t{st|stw} %s,%d(%s)\n", - reg_names[0], save_lr, reg_names[1]); + asm_fprintf (file, "\t{st|stw} %s,4(%s)\n", + reg_names[0], reg_names[1]); /* Now, we need to get the address of the label. */ - fputs ("\tbl 1f\n\t.long ", file); + fputs ("\tbcl 20,31,1f\n\t.long ", file); assemble_name (file, buf); fputs ("-.\n1:", file); asm_fprintf (file, "\tmflr %s\n", reg_names[11]); @@ -15478,8 +15493,8 @@ output_function_profiler (FILE *file, int labelno) asm_fprintf (file, "\t{liu|lis} %s,", reg_names[12]); assemble_name (file, buf); fputs ("@ha\n", file); - asm_fprintf (file, "\t{st|stw} %s,%d(%s)\n", - reg_names[0], save_lr, reg_names[1]); + asm_fprintf (file, "\t{st|stw} %s,4(%s)\n", + reg_names[0], reg_names[1]); asm_fprintf (file, "\t{cal|la} %s,", reg_names[0]); assemble_name (file, buf); asm_fprintf (file, "@l(%s)\n", reg_names[12]); -- 2.30.2