output.h (SECTION_OVERRIDE): Define.
authorAnthony Green <green@redhat.com>
Mon, 4 Feb 2002 03:03:44 +0000 (03:03 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Mon, 4 Feb 2002 03:03:44 +0000 (03:03 +0000)
2002-02-04  Anthony Green  <green@redhat.com>

* output.h (SECTION_OVERRIDE): Define.
* varasm.c (named_section): Obey SECTION_OVERRIDE.

java:
2002-02-04  Anthony Green  <green@redhat.com>

* class.c (build_utf8_ref): Put UTF-8 constants into merged
sections if available.

From-SVN: r49469

gcc/ChangeLog
gcc/java/ChangeLog
gcc/java/class.c
gcc/output.h
gcc/varasm.c

index 1190b3b39d1f734f9df569ae820f5ddf7df37059..babb0e450c8304d859d33f55ee6bf5a770d9107c 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-04  Anthony Green  <green@redhat.com>
+
+       * output.h (SECTION_OVERRIDE): Define.
+       * varasm.c (named_section): Obey SECTION_OVERRIDE.
+
 2002-02-03  Jason Thorpe  <thorpej@wasabisystems.com>
 
        * config.gcc (arm*-*-netbsdelf*): Placeholder to prevent match
index df6c6c1737dc0cf1018eaf161563a04645e69a0e..f6111e749d2f33e247e4c28f95603e2d633a9686 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-04  Anthony Green  <green@redhat.com>
+
+       * class.c (build_utf8_ref): Put UTF-8 constants into merged
+       sections if available.
+
 2002-02-04  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
 
        * parse.y (java_expand_classes): Fix typo in static field loop.
index 2e70081e095bb66ad99fcc56796ac5d0d2d95a48..367a448c72a49e09fcb2bfb728e0977f4a9088c2 100644 (file)
@@ -967,7 +967,7 @@ build_utf8_ref (name)
   char buf[60];
   tree ctype, field = NULL_TREE, str_type, cinit, string;
   static int utf8_count = 0;
-  int name_hash;
+  int name_hash, decl_size;
   tree ref = IDENTIFIER_UTF8_REF (name);
   tree decl;
   if (ref != NULL_TREE)
@@ -1000,6 +1000,20 @@ build_utf8_ref (name)
   TREE_READONLY (decl) = 1;
   TREE_THIS_VOLATILE (decl) = 0;
   DECL_INITIAL (decl) = cinit;
+#ifdef HAVE_GAS_SHF_MERGE
+  /* Ensure decl_size is a multiple of utf8const_type's alignment. */
+  decl_size = (name_len + 5 + TYPE_ALIGN_UNIT (utf8const_type) - 1)
+              & ~(TYPE_ALIGN_UNIT (utf8const_type) - 1);
+  if (flag_merge_constants && decl_size < 256)
+    {
+      char buf[32];
+      int flags = (SECTION_OVERRIDE
+                  | SECTION_MERGE | (SECTION_ENTSIZE & decl_size));
+      sprintf (buf, ".rodata.jutf8.%d", decl_size);
+      named_section_flags (buf, flags);
+      DECL_SECTION_NAME (decl) = build_string (strlen (buf), buf);
+    }
+#endif
   TREE_CHAIN (decl) = utf8_decl_list;
   layout_decl (decl, 0);
   pushdecl (decl);
index 1a2eefb36ebcf8e14d55c55d6b224f3856955299..cb5e4d089a1720dadd3030250aad5c43325bf071 100644 (file)
@@ -512,7 +512,8 @@ extern void no_asm_to_stream PARAMS ((FILE *));
 #define SECTION_MERGE   0x08000        /* contains mergeable data */
 #define SECTION_STRINGS  0x10000       /* contains zero terminated strings without
                                           embedded zeros */
-#define SECTION_MACH_DEP 0x20000       /* subsequent bits reserved for target */
+#define SECTION_OVERRIDE 0x20000       /* allow override of default flags */
+#define SECTION_MACH_DEP 0x40000       /* subsequent bits reserved for target */
 
 extern unsigned int get_named_section_flags PARAMS ((const char *));
 extern bool set_named_section_flags    PARAMS ((const char *, unsigned int));
index 955a98e9c6ce6b6c35b1193bb2a8beb5729070d5..8bd5807c46d32eecc9cabb9aec102e812309d42e 100644 (file)
@@ -445,11 +445,15 @@ named_section (decl, name, reloc)
   flags = (* targetm.section_type_flags) (decl, name, reloc);
 
   /* Sanity check user variables for flag changes.  Non-user
-     section flag changes will abort in named_section_flags.  */
+     section flag changes will abort in named_section_flags.
+     However, don't complain if SECTION_OVERRIDE is set.
+     We trust that the setter knows that it is safe to ignore
+     the default flags for this decl.  */
   if (decl && ! set_named_section_flags (name, flags))
     {
-      error_with_decl (decl, "%s causes a section type conflict");
       flags = get_named_section_flags (name);
+      if ((flags & SECTION_OVERRIDE) == 0)
+       error_with_decl (decl, "%s causes a section type conflict");
     }
 
   named_section_flags (name, flags);