Commit 71625f3d by Alan Modra Committed by Alan Modra

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
parent 2e3f0db6
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> 2005-06-09 Dale Johannesen <dalej@apple.com>
* config/i386/i386.c (optimization_options): Make -fno-math-errno * config/i386/i386.c (optimization_options): Make -fno-math-errno
......
/* Definitions of target machine for GNU compiler, /* Definitions of target machine for GNU compiler,
for PowerPC machines running Linux. 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. Free Software Foundation, Inc.
Contributed by Michael Meissner (meissner@cygnus.com). Contributed by Michael Meissner (meissner@cygnus.com).
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
process. */ process. */
#define OS_MISSING_POWERPC64 1 #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. */ /* glibc has float and long double forms of math functions. */
#undef TARGET_C99_FUNCTIONS #undef TARGET_C99_FUNCTIONS
#define TARGET_C99_FUNCTIONS 1 #define TARGET_C99_FUNCTIONS 1
......
...@@ -207,7 +207,7 @@ extern int dot_symbols; ...@@ -207,7 +207,7 @@ extern int dot_symbols;
#endif #endif
/* We use glibc _mcount for profiling. */ /* We use glibc _mcount for profiling. */
#define NO_PROFILE_COUNTERS TARGET_64BIT #define NO_PROFILE_COUNTERS 1
#define PROFILE_HOOK(LABEL) \ #define PROFILE_HOOK(LABEL) \
do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
......
...@@ -15433,7 +15433,6 @@ void ...@@ -15433,7 +15433,6 @@ void
output_function_profiler (FILE *file, int labelno) output_function_profiler (FILE *file, int labelno)
{ {
char buf[100]; char buf[100];
int save_lr = 8;
switch (DEFAULT_ABI) switch (DEFAULT_ABI)
{ {
...@@ -15441,7 +15440,6 @@ output_function_profiler (FILE *file, int labelno) ...@@ -15441,7 +15440,6 @@ output_function_profiler (FILE *file, int labelno)
gcc_unreachable (); gcc_unreachable ();
case ABI_V4: case ABI_V4:
save_lr = 4;
if (!TARGET_32BIT) if (!TARGET_32BIT)
{ {
warning (0, "no profiling of 64-bit code for this ABI"); warning (0, "no profiling of 64-bit code for this ABI");
...@@ -15449,11 +15447,28 @@ output_function_profiler (FILE *file, int labelno) ...@@ -15449,11 +15447,28 @@ output_function_profiler (FILE *file, int labelno)
} }
ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno); ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
fprintf (file, "\tmflr %s\n", reg_names[0]); 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); fputs ("\tbl _GLOBAL_OFFSET_TABLE_@local-4\n", file);
asm_fprintf (file, "\t{st|stw} %s,%d(%s)\n", asm_fprintf (file, "\t{st|stw} %s,4(%s)\n",
reg_names[0], save_lr, reg_names[1]); reg_names[0], reg_names[1]);
asm_fprintf (file, "\tmflr %s\n", reg_names[12]); asm_fprintf (file, "\tmflr %s\n", reg_names[12]);
asm_fprintf (file, "\t{l|lwz} %s,", reg_names[0]); asm_fprintf (file, "\t{l|lwz} %s,", reg_names[0]);
assemble_name (file, buf); assemble_name (file, buf);
...@@ -15461,10 +15476,10 @@ output_function_profiler (FILE *file, int labelno) ...@@ -15461,10 +15476,10 @@ output_function_profiler (FILE *file, int labelno)
} }
else if (flag_pic > 1) else if (flag_pic > 1)
{ {
asm_fprintf (file, "\t{st|stw} %s,%d(%s)\n", asm_fprintf (file, "\t{st|stw} %s,4(%s)\n",
reg_names[0], save_lr, reg_names[1]); reg_names[0], reg_names[1]);
/* Now, we need to get the address of the label. */ /* 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); assemble_name (file, buf);
fputs ("-.\n1:", file); fputs ("-.\n1:", file);
asm_fprintf (file, "\tmflr %s\n", reg_names[11]); asm_fprintf (file, "\tmflr %s\n", reg_names[11]);
...@@ -15478,8 +15493,8 @@ output_function_profiler (FILE *file, int labelno) ...@@ -15478,8 +15493,8 @@ output_function_profiler (FILE *file, int labelno)
asm_fprintf (file, "\t{liu|lis} %s,", reg_names[12]); asm_fprintf (file, "\t{liu|lis} %s,", reg_names[12]);
assemble_name (file, buf); assemble_name (file, buf);
fputs ("@ha\n", file); fputs ("@ha\n", file);
asm_fprintf (file, "\t{st|stw} %s,%d(%s)\n", asm_fprintf (file, "\t{st|stw} %s,4(%s)\n",
reg_names[0], save_lr, reg_names[1]); reg_names[0], reg_names[1]);
asm_fprintf (file, "\t{cal|la} %s,", reg_names[0]); asm_fprintf (file, "\t{cal|la} %s,", reg_names[0]);
assemble_name (file, buf); assemble_name (file, buf);
asm_fprintf (file, "@l(%s)\n", reg_names[12]); asm_fprintf (file, "@l(%s)\n", reg_names[12]);
......
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