From: Anthony Green Date: Mon, 4 Feb 2002 03:03:44 +0000 (+0000) Subject: output.h (SECTION_OVERRIDE): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10c459437e4444fc5a111d1c3bdb96022e23716f;p=gcc.git output.h (SECTION_OVERRIDE): Define. 2002-02-04 Anthony Green * output.h (SECTION_OVERRIDE): Define. * varasm.c (named_section): Obey SECTION_OVERRIDE. java: 2002-02-04 Anthony Green * class.c (build_utf8_ref): Put UTF-8 constants into merged sections if available. From-SVN: r49469 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1190b3b39d1..babb0e450c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-02-04 Anthony Green + + * output.h (SECTION_OVERRIDE): Define. + * varasm.c (named_section): Obey SECTION_OVERRIDE. + 2002-02-03 Jason Thorpe * config.gcc (arm*-*-netbsdelf*): Placeholder to prevent match diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index df6c6c1737d..f6111e749d2 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2002-02-04 Anthony Green + + * class.c (build_utf8_ref): Put UTF-8 constants into merged + sections if available. + 2002-02-04 Bryce McKinlay * parse.y (java_expand_classes): Fix typo in static field loop. diff --git a/gcc/java/class.c b/gcc/java/class.c index 2e70081e095..367a448c72a 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -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); diff --git a/gcc/output.h b/gcc/output.h index 1a2eefb36eb..cb5e4d089a1 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -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)); diff --git a/gcc/varasm.c b/gcc/varasm.c index 955a98e9c6c..8bd5807c46d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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);