aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2003-07-16 19:05:53 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2003-07-16 12:05:53 -0700
commit1622229cb182906d9375ccbb6dd6672b9cb017da (patch)
tree764c34de1b929602e5ba4745ef412025e5a8a134
parentdb2f435beacd8e9e9f07616c5806acb518ff821c (diff)
downloadgcc-1622229cb182906d9375ccbb6dd6672b9cb017da.zip
gcc-1622229cb182906d9375ccbb6dd6672b9cb017da.tar.gz
gcc-1622229cb182906d9375ccbb6dd6672b9cb017da.tar.bz2
Partial Fix PR/10129
2003-07-17 Andrew Pinski <pinskia@physics.uc.edu> Partial Fix PR/10129 * config/darwin.c (machopic_function_base_name): Only Return "<pic base>". (machopic_output_function_base_name): New; print the true pic label. (machopic_classify_ident): Pic Base is always a defined data. * config/darwin.h (ASM_OUTPUT_LABELREF): Support the pic base label. * config/darwin-proto.h (machopic_output_function_base_name): Prototype. From-SVN: r69472
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/darwin-protos.h1
-rw-r--r--gcc/config/darwin.c58
-rw-r--r--gcc/config/darwin.h4
4 files changed, 40 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5778c5c..5a893d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2003-07-17 Andrew Pinski <pinskia@physics.uc.edu>
+
+ Partial Fix PR/10129
+ * config/darwin.c (machopic_function_base_name): Only Return "<pic base>".
+ (machopic_output_function_base_name): New; print the true pic label.
+ (machopic_classify_ident): Pic Base is always a defined data.
+ * config/darwin.h (ASM_OUTPUT_LABELREF): Support the pic base label.
+ * config/darwin-proto.h (machopic_output_function_base_name): Prototype.
+
2003-07-16 Andrew Pinski <pinskia@physics.uc.edu>
* gcse.c (gcse_constant_p): COMPARE of the same registers is a constant
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index ad8b234..f17f5ab 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -23,6 +23,7 @@ extern int name_needs_quotes PARAMS ((const char *));
extern void machopic_validate_stub_or_non_lazy_ptr PARAMS ((const char *, int));
extern const char *machopic_function_base_name PARAMS ((void));
+extern void machopic_output_function_base_name (FILE *);
extern const char *machopic_non_lazy_ptr_name PARAMS ((const char*));
extern const char *machopic_stub_name PARAMS ((const char*));
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index d57c293..ab438ec 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -81,6 +81,10 @@ machopic_classify_ident (ident)
&& name[4] == 'C'
&& name[5] == '_'));
tree temp;
+
+ /* The PIC base symbol is always defined. */
+ if (! strcmp (name, "<pic base>"))
+ return MACHOPIC_DEFINED_DATA;
if (name[0] != '!')
{
@@ -218,54 +222,46 @@ machopic_define_name (name)
machopic_define_ident (get_identifier (name));
}
-/* This is a static to make inline functions work. The rtx
- representing the PIC base symbol always points to here.
-
- 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 ()
{
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));
- if (function_base_func_name != current_name)
- {
- current_function_uses_pic_offset_table = 1;
+ if (function_base == NULL)
+ function_base =
+ (char *) ggc_alloc_string ("<pic base>", sizeof ("<pic base>"));
- /* Save mucho space and time. Some of the C++ mangled names are over
- 700 characters long! Note that we produce a label containing a '-'
- if the function we're compiling is an Objective-C method, as evinced
- 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_function_uses_pic_offset_table = 1;
- ++current_pic_label_num;
- if (*current_name == '+' || *current_name == '-')
- sprintf (function_base, "*\"L-%010d$pb\"", current_pic_label_num);
- else
- sprintf (function_base, "*\"L%011d$pb\"", current_pic_label_num);
+ return function_base;
+}
+
+static GTY(()) const char * function_base_func_name;
+static GTY(()) int current_pic_label_num;
+
+void
+machopic_output_function_base_name (FILE *file)
+{
+ 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));
+ if (function_base_func_name != current_name)
+ {
+ ++current_pic_label_num;
function_base_func_name = current_name;
}
-
- return function_base;
+ fprintf (file, "\"L%011d$pb\"", current_pic_label_num);
}
static GTY(()) tree machopic_non_lazy_pointers;
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 8a95909..4f9b487 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -396,7 +396,9 @@ do { text_section (); \
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
do { \
const char *xname = darwin_strip_name_encoding (NAME); \
- if (xname[0] == '&' || xname[0] == '*') \
+ if (! strcmp (xname, "<pic base>")) \
+ machopic_output_function_base_name(FILE); \
+ else if (xname[0] == '&' || xname[0] == '*') \
{ \
int len = strlen (xname); \
if (len > 6 && !strcmp ("$stub", xname + len - 5)) \