This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
select_section patch for HEAD
- From: Geoffrey Keating <gkeating at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Jul 2003 11:17:28 -0700 (PDT)
- Subject: select_section patch for HEAD
This fixes g++.old-deja/g++.law/ctors2.C and
g++.old-deja/g++.pt/instantiate12.C in HEAD.
Bootstrapped & tested on powerpc-darwin.
--
- Geoffrey Keating <geoffk@apple.com>
====================
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.526
diff -u -p -u -p -r2.526 ChangeLog
--- ChangeLog 16 Jul 2003 17:44:46 -0000 2.526
+++ ChangeLog 16 Jul 2003 18:15:20 -0000
@@ -1,3 +1,8 @@
+2003-07-16 Geoffrey Keating <geoffk@apple.com>
+
+ * config/darwin.c (machopic_select_section): Use decl_readonly_section
+ to do most of the work.
+
2003-07-16 Hans-Peter Nilsson <hp@bitrange.com>
* config/mmix/mmix-protos.h: Convert prototypes to ISO C90.
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.38
diff -u -p -u -p -r1.38 darwin.c
--- config/darwin.c 7 Jun 2003 17:11:38 -0000 1.38
+++ config/darwin.c 16 Jul 2003 18:15:21 -0000
@@ -1157,18 +1157,22 @@ machopic_select_section (exp, reloc, ali
int reloc;
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED;
{
- if (TREE_CODE (exp) == STRING_CST)
- {
- if (flag_writable_strings)
- data_section ();
- else if ((size_t) TREE_STRING_LENGTH (exp) !=
- strlen (TREE_STRING_POINTER (exp)) + 1)
- readonly_data_section ();
- else
- cstring_section ();
- }
- else if (TREE_CODE (exp) == INTEGER_CST
- || TREE_CODE (exp) == REAL_CST)
+ void (*base_function)(void);
+
+ if (decl_readonly_section_1 (exp, reloc, MACHOPIC_INDIRECT))
+ base_function = readonly_data_section;
+ else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
+ base_function = const_data_section;
+ else
+ base_function = data_section;
+
+ if (TREE_CODE (exp) == STRING_CST
+ && ((size_t) TREE_STRING_LENGTH (exp)
+ == strlen (TREE_STRING_POINTER (exp)) + 1)
+ && ! flag_writable_strings)
+ cstring_section ();
+ else if ((TREE_CODE (exp) == INTEGER_CST || TREE_CODE (exp) == REAL_CST)
+ && flag_merge_constants)
{
tree size = TYPE_SIZE (TREE_TYPE (exp));
@@ -1181,7 +1185,7 @@ machopic_select_section (exp, reloc, ali
TREE_INT_CST_HIGH (size) == 0)
literal8_section ();
else
- readonly_data_section ();
+ base_function ();
}
else if (TREE_CODE (exp) == CONSTRUCTOR
&& TREE_TYPE (exp)
@@ -1195,16 +1199,8 @@ machopic_select_section (exp, reloc, ali
objc_constant_string_object_section ();
else if (!strcmp (IDENTIFIER_POINTER (name), "NXConstantString"))
objc_string_object_section ();
- else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
- {
-
- if (TREE_SIDE_EFFECTS (exp) || (MACHOPIC_INDIRECT && reloc))
- const_data_section ();
- else
- readonly_data_section ();
- }
else
- data_section ();
+ base_function ();
}
else if (TREE_CODE (exp) == VAR_DECL &&
DECL_NAME (exp) &&
@@ -1258,28 +1254,11 @@ machopic_select_section (exp, reloc, ali
objc_cat_cls_meth_section ();
else if (!strncmp (name, "_OBJC_PROTOCOL_", 15))
objc_protocol_section ();
- else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp))
- && !TREE_SIDE_EFFECTS (exp))
- {
-
- if (MACHOPIC_INDIRECT && reloc)
- const_data_section ();
- else
- readonly_data_section ();
- }
- else
- data_section ();
- }
- else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
- {
-
- if (TREE_SIDE_EFFECTS (exp) || (MACHOPIC_INDIRECT && reloc))
- const_data_section ();
else
- readonly_data_section ();
+ base_function ();
}
else
- data_section ();
+ base_function ();
}
/* This can be called with address expressions as "rtx".