Fix profiling support and unique section support.
authorPhilip Blundell <pb@nexus.co.uk>
Wed, 15 Sep 1999 14:27:19 +0000 (14:27 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Wed, 15 Sep 1999 14:27:19 +0000 (14:27 +0000)
From-SVN: r29436

gcc/ChangeLog
gcc/config/arm/linux-elf.h

index f143f1396898bc4ae85bc59c2982daecfca7bc5f..d4bc5495e36c31f8b1f22f8abf4b9ea4f5b9a0b9 100644 (file)
@@ -1,3 +1,11 @@
+Wed Sep 15 15:23:28 1999  Philip Blundell  <pb@nexus.co.uk>
+
+       * config/arm/linux-elf.h (MAKE_DECL_ONE_ONLY): Copy definition
+       from config/svr4.h.
+       (UNIQUE_SECTION_P, UNIQUE_SECTION): Likewise.
+       (FUNCTION_PROFILER): Redefine appropriately for Linux.
+       (CC1_SPEC): Likewise.
+
 Wed Sep 15 10:09:48 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * genattr.c (main): Add extern prototype.  Call return, not exit.
index 78fd7434116e62ef1c81274d9785ecf576400fc4..f7bd3b29fa2ff5998b5d12ab13d7361b13e26185 100644 (file)
@@ -224,6 +224,44 @@ const_section ()                                                   \
     const_section ();                                                  \
 }
 
+#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+#define UNIQUE_SECTION_P(DECL)   (DECL_ONE_ONLY (DECL))
+
+#define UNIQUE_SECTION(DECL, RELOC)                            \
+  do                                                           \
+    {                                                          \
+      int len;                                                 \
+      char * name;                                             \
+      char * string;                                           \
+      char * prefix;                                           \
+                                                               \
+      name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));  \
+                                                               \
+      if (! DECL_ONE_ONLY (DECL))                              \
+       {                                                       \
+         prefix = ".";                                         \
+         if (TREE_CODE (DECL) == FUNCTION_DECL)                \
+           prefix = ".text.";                                  \
+         else if (DECL_READONLY_SECTION (DECL, RELOC))         \
+           prefix = ".rodata.";                                \
+         else                                                  \
+           prefix = ".data.";                                  \
+       }                                                       \
+      else if (TREE_CODE (DECL) == FUNCTION_DECL)              \
+       prefix = ".gnu.linkonce.t.";                            \
+      else if (DECL_READONLY_SECTION (DECL, RELOC))            \
+       prefix = ".gnu.linkonce.r.";                            \
+      else                                                     \
+       prefix = ".gnu.linkonce.d.";                            \
+                                                               \
+      len = strlen (name) + strlen (prefix);                   \
+      string = alloca (len + 1);                               \
+      sprintf (string, "%s%s", prefix, name);                  \
+                                                               \
+      DECL_SECTION_NAME (DECL) = build_string (len, string);   \
+    }                                                          \
+  while (0)
+
 /* A C statement or statements to switch to the appropriate
    section for output of RTX in mode MODE.  RTX is some kind
    of constant in RTL.  The argument MODE is redundant except
@@ -267,3 +305,13 @@ const_section ()                                                   \
 /* NWFPE always understands FPA instructions.  */
 #undef  FP_DEFAULT
 #define FP_DEFAULT FP_SOFT3
+
+/* Call the function profiler with a given profile label.  */
+#undef  FUNCTION_PROFILER
+#define FUNCTION_PROFILER(STREAM, LABELNO)                             \
+{                                                                      \
+  fprintf (STREAM, "\tbl\tmcount%s\n", NEED_PLT_RELOC ? "(PLT)" : ""); \
+}
+
+#undef  CC1_SPEC
+#define CC1_SPEC "%{profile:-p}"