diff options
author | Alan Modra <amodra@bigpond.net.au> | 2005-06-10 01:44:59 +0000 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2005-06-10 11:14:59 +0930 |
commit | 71625f3dc600a9b363a02c996269a7e97d11c841 (patch) | |
tree | ee2a5c2a0f9046974f3feece3f2d968b3247fd61 | |
parent | 2e3f0db6f996d6b3d84955391263e9d035d58760 (diff) | |
download | gcc-71625f3dc600a9b363a02c996269a7e97d11c841.zip gcc-71625f3dc600a9b363a02c996269a7e97d11c841.tar.gz gcc-71625f3dc600a9b363a02c996269a7e97d11c841.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/linux.h | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/linux64.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 35 |
4 files changed, 38 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b91d5d0..b1fc45c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-06-10 Alan Modra <amodra@bigpond.net.au> + + * 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 <dalej@apple.com> * 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 e35f033..c7edf50 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 d2ab9bf..29e1825 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 5aa2558..95ed9e0 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]); |