]> gcc.gnu.org Git - gcc.git/commitdiff
Add support for unique sections in arm-linux target.
authorPhilip Blundell <philb@gnu.org>
Mon, 19 Mar 2001 19:56:37 +0000 (19:56 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Mon, 19 Mar 2001 19:56:37 +0000 (19:56 +0000)
From-SVN: r40632

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

index 0eb39de722a1ce73387847f8e991aa954117c041..cf7f7e4c81f326b27686ef5fd84a2549803f0d08 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-19  Philip Blundell  <philb@gnu.org>
+
+       * arm/linux-elf.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define.
+       (UNIQUE_SECTION): Define.
+
 2001-03-19  Mark Mitchell  <mark@codesourcery.com>
 
        * cse.c (find_comparison_args): Update documentation.  Fix
index 09e4e156f72779b741b86d242b13bac19630fabd..cef9896705c2c7489caa8aea46f986d9c2621fd2 100644 (file)
@@ -235,6 +235,44 @@ const_section ()                                                   \
    go into the const section.  */
 #define SELECT_RTX_SECTION(MODE,RTX) 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)
+
 /* On svr4, we *do* have support for the .init and .fini sections, and we
    can put stuff in there to be executed before and after `main'.  We let
    crtstuff.c and other files know this by defining the following symbols.
This page took 0.0765400000000001 seconds and 5 git commands to generate.