diff options
author | Geoffrey Keating <geoffk@apple.com> | 2003-03-19 03:23:44 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2003-03-19 03:23:44 +0000 |
commit | 6788f5ca12b792117998e35270093704fa257857 (patch) | |
tree | 4d43639afd8328544c86b6630fd7a68f0f8f673d | |
parent | 178274da22dd1139e61f1102de5e8f79a1bc9442 (diff) | |
download | gcc-6788f5ca12b792117998e35270093704fa257857.zip gcc-6788f5ca12b792117998e35270093704fa257857.tar.gz gcc-6788f5ca12b792117998e35270093704fa257857.tar.bz2 |
rs6000.c (rs6000_emit_prologue): Don't clone the result of machopic_function_base_name.
* config/rs6000/rs6000.c (rs6000_emit_prologue): Don't clone
the result of machopic_function_base_name.
* config/darwin.c (machopic_function_base_name): Use a gc-allocated
string rather than a static array.
From-SVN: r64569
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/darwin.c | 28 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 2 |
3 files changed, 25 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6564254..4c8d0b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -18,6 +18,11 @@ 2003-03-18 Geoffrey Keating <geoffk@apple.com> + * config/rs6000/rs6000.c (rs6000_emit_prologue): Don't clone + the result of machopic_function_base_name. + * config/darwin.c (machopic_function_base_name): Use a gc-allocated + string rather than a static array. + * Makefile.in (emit-rtl.o): Add gt-emit-rtl.h to dependencies. * gengtype.c: Include rtl.h. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 86b3425..934d997 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -219,24 +219,26 @@ machopic_define_name (name) } /* This is a static to make inline functions work. The rtx - representing the PIC base symbol always points to here. */ + representing the PIC base symbol always points to here. -static char function_base[32]; + FIXME: The rest of the compiler doesn't expect strings to change. */ +static GTY(()) char * function_base; +static GTY(()) const char * function_base_func_name; static GTY(()) int current_pic_label_num; const char * machopic_function_base_name () { - static const char *name = NULL; - static const char *current_name; + const char *current_name; /* if dynamic-no-pic is on, we should not get here */ if (MACHO_DYNAMIC_NO_PIC_P) abort (); - current_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)); + current_name = + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)); - if (name != current_name) + if (function_base_func_name != current_name) { current_function_uses_pic_offset_table = 1; @@ -246,13 +248,21 @@ machopic_function_base_name () by the incredibly scientific test below. This is because code in rs6000.c makes the same ugly test when loading the PIC reg. */ + /* It's hard to describe just how ugly this is. The reason for + the '%011d' is that after a PCH load, we can't change the + size of the string, because PCH will have uniqued it and + allocated it in the string pool. */ + if (function_base == NULL) + function_base = + (char *) ggc_alloc_string ("", sizeof ("*\"L12345678901$pb\"")); + ++current_pic_label_num; if (*current_name == '+' || *current_name == '-') - sprintf (function_base, "*\"L-%d$pb\"", current_pic_label_num); + sprintf (function_base, "*\"L-%010d$pb\"", current_pic_label_num); else - sprintf (function_base, "*L%d$pb", current_pic_label_num); + sprintf (function_base, "*\"L%011d$pb\"", current_pic_label_num); - name = current_name; + function_base_func_name = current_name; } return function_base; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b78e837..ff3f940 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -10799,7 +10799,7 @@ rs6000_emit_prologue () { rtx dest = gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM); const char *picbase = machopic_function_base_name (); - rtx src = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1)); + rtx src = gen_rtx_SYMBOL_REF (Pmode, picbase); rs6000_maybe_dead (emit_insn (gen_load_macho_picbase (dest, src))); |