]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport new macros UNIQUE_SECTION, UNIQUE_SECTION_P, MAKE_DECL_ONE_ONLY.
authorBernd Schmidt <bernds@redhat.com>
Tue, 3 Apr 2001 12:37:00 +0000 (12:37 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Tue, 3 Apr 2001 12:37:00 +0000 (12:37 +0000)
From-SVN: r41055

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

index ce7e2792ea720990b2bc45d02d31479ca458c8e4..cbf9b5f289d8370578123ccbf139b79890ab2e0e 100644 (file)
@@ -9,6 +9,10 @@
        different modes so that we don't introduce SUBREGs into memory
        addresses.
 
+       2001-02-02  Philip Blundell  <philb@gnu.org>
+       * arm/linux-elf.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define.
+       (UNIQUE_SECTION): Define.                                  
+
 2001-03-30  Bernd Schmidt  <bernds@redhat.com>
 
        * jump.c (delete_barrier_successors): Fix error in last change.
index a7e9e28938f0555bac5d8f33cc1207aba9aa9ea8..559fb7773f229f168390e60f411af0d1e599e252 100644 (file)
@@ -223,6 +223,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.