]> gcc.gnu.org Git - gcc.git/commitdiff
linux.h (NO_PROFILE_COUNTERS): Define.
authorAlan Modra <amodra@bigpond.net.au>
Fri, 10 Jun 2005 01:44:59 +0000 (01:44 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 10 Jun 2005 01:44:59 +0000 (11:14 +0930)
* 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
gcc/config/rs6000/linux.h
gcc/config/rs6000/linux64.h
gcc/config/rs6000/rs6000.c

index b91d5d064bfded06942f3695d937255cfcc45aa8..b1fc45c604d055790ed32db0115b6d331ebdb0e5 100644 (file)
@@ -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
index e35f03347e1ce25a7a09ea2f402d6b71b8d2a648..c7edf500a7e38c8150c4ed67dfe2073f5d043561 100644 (file)
@@ -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
index d2ab9bf65aeed0eac91740588097849f8eaf221d..29e182522f85211ac94ae08d608bb2cd0c10e18d 100644 (file)
@@ -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)
 
index 5aa2558d0fb1e7885d588e238cfd0200f3356068..95ed9e0b34e5bf06120217730992e0493bfc9abd 100644 (file)
@@ -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 ("\tb1f\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]);
This page took 0.107803 seconds and 5 git commands to generate.