OSDN Git Service

2002-02-04 Anthony Green <green@redhat.com>
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Feb 2002 03:03:44 +0000 (03:03 +0000)
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Feb 2002 03:03:44 +0000 (03:03 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49469 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 1190b3b..babb0e4 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 df6c6c1..f6111e7 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 2e70081..367a448 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 1a2eefb..cb5e4d0 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 955a98e..8bd5807 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);