iris6gld.h (MAKE_DECL_ONE_ONLY): Define.
authorMark Mitchell <mark@codesourcery.com>
Tue, 20 Jul 1999 00:41:56 +0000 (00:41 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 20 Jul 1999 00:41:56 +0000 (00:41 +0000)
* config/mips/iris6gld.h (MAKE_DECL_ONE_ONLY): Define.
(UNIQUE_SECTION_P): Likewise.
(UNIQUE_SECTION): Likewise.

From-SVN: r28182

gcc/ChangeLog
gcc/config/mips/iris6gld.h

index 6c8acf92706bb91185f6183fdbd7a84a785e2c4f..9b7d8a62b1ddb37cb1005a3eef62a9bfa19560de 100644 (file)
@@ -1,3 +1,9 @@
+Mon Jul 19 14:22:18 1999  Mark P. Mitchell  <mark@codesourcery.com>
+
+       * config/mips/iris6gld.h (MAKE_DECL_ONE_ONLY): Define.
+       (UNIQUE_SECTION_P): Likewise.
+       (UNIQUE_SECTION): Likewise.
+
 1999-07-19  Linas Vepstas  <linas@linas.org>
 
        * config/i370/README: New file.
index 59a7347838ea74f71f9b9b631d15115d35aae439..88a5f68e2063be4299d3d4f7a0bc99362b112398 100644 (file)
@@ -46,3 +46,38 @@ Boston, MA 02111-1307, USA.  */
   %{!shared: %{!non_shared: %{!call_shared: -call_shared}}}} \
 %{rpath} -init __do_global_ctors -fini __do_global_dtors \
 %{mabi=32: -melf32bsmip}%{mabi=n32: -melfbmipn32}%{mabi=64: -melf64bmip}%{!mabi*: -melf32bmipn32}"
+
+/* The GNU linker supports one-only sections.  */
+#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+#undef UNIQUE_SECTION_P
+#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
+#define UNIQUE_SECTION(DECL,RELOC)                             \
+do {                                                           \
+  int len;                                                     \
+  char *name, *string, *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)