diff options
author | Matt Austern <austern@apple.com> | 2004-08-31 18:06:59 +0000 |
---|---|---|
committer | Matt Austern <austern@gcc.gnu.org> | 2004-08-31 18:06:59 +0000 |
commit | c61eceebfae296bfab51a3af14bf09f2808d260c (patch) | |
tree | 40263df7a28894638885bb2f4183ce077287b7da | |
parent | 4bceb077ac4d1b221e4476f988c6717959774d7d (diff) | |
download | gcc-c61eceebfae296bfab51a3af14bf09f2808d260c.zip gcc-c61eceebfae296bfab51a3af14bf09f2808d260c.tar.gz gcc-c61eceebfae296bfab51a3af14bf09f2808d260c.tar.bz2 |
darwin.c (darwin_make_decl_one_only): Allocate section names once per compilation, instead of once per symbol.
* config/darwin.c (darwin_make_decl_one_only): Allocate section
names once per compilation, instead of once per symbol.
From-SVN: r86836
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/darwin.c | 21 |
2 files changed, 20 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0331aa..66806ed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-08-31 Matt Austern <austern@apple.com> + + * config/darwin.c (darwin_make_decl_one_only): Allocate section + names once per compilation, instead of once per symbol. + 2004-08-31 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (build_subdir): New substitution. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 44c8539..e9e509c 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -982,18 +982,27 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED) SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_STATIC; } +static GTY(()) tree textcoal_section = 0; +static GTY(()) tree datacoal_section = 0; + void darwin_make_decl_one_only (tree decl) { - static const char *text_section = "__TEXT,__textcoal_nt,coalesced,no_toc"; - static const char *data_section = "__DATA,__datacoal_nt,coalesced,no_toc"; + tree sec = 0; + if (textcoal_section == 0) + { + static const char *ts = "__TEXT,__textcoal_nt,coalesced,no_toc"; + static const char *ds = "__DATA,__datacoal_nt,coalesced,no_toc"; + textcoal_section = build_string (strlen (ts), ts); + datacoal_section = build_string (strlen (ds), ds); + } - const char *sec = TREE_CODE (decl) == FUNCTION_DECL - ? text_section - : data_section; + sec = TREE_CODE (decl) == FUNCTION_DECL + ? textcoal_section + : datacoal_section; TREE_PUBLIC (decl) = 1; DECL_ONE_ONLY (decl) = 1; - DECL_SECTION_NAME (decl) = build_string (strlen (sec), sec); + DECL_SECTION_NAME (decl) = sec; } void |