Fix SELECT_SECTION() so that C++ run-time type info constructors do not go in

.rodata on PIC systems, which was causing text relocations (and associated
performance loss).
This commit is contained in:
mycroft 2002-08-28 14:05:58 +00:00
parent 6ec2abba01
commit c38b03a8c7
2 changed files with 8 additions and 12 deletions

View File

@ -402,7 +402,9 @@ void FN () \
#define SELECT_SECTION(DECL,RELOC) \
{ \
if (TREE_CODE (DECL) == STRING_CST) \
if (flag_pic && RELOC) \
data_section (); \
else if (TREE_CODE (DECL) == STRING_CST) \
{ \
if (! flag_writable_strings) \
const_section (); \
@ -411,11 +413,7 @@ void FN () \
} \
else if (TREE_CODE (DECL) == VAR_DECL) \
{ \
if ((flag_pic && RELOC) \
|| !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
|| !DECL_INITIAL (DECL) \
|| (DECL_INITIAL (DECL) != error_mark_node \
&& !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
if (! DECL_READONLY_SECTION (DECL, RELOC)) \
{ \
int size = int_size_in_bytes (TREE_TYPE (DECL)); \
if (size >= 0 && size <= g_switch_value) \

View File

@ -411,7 +411,9 @@ dtors_section () \
#define SELECT_SECTION(DECL,RELOC) \
{ \
if (TREE_CODE (DECL) == STRING_CST) \
if (flag_pic && RELOC) \
data_section (); \
else if (TREE_CODE (DECL) == STRING_CST) \
{ \
if (! flag_writable_strings) \
const_section (); \
@ -420,11 +422,7 @@ dtors_section () \
} \
else if (TREE_CODE (DECL) == VAR_DECL) \
{ \
if ((flag_pic && RELOC) \
|| !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
|| !DECL_INITIAL (DECL) \
|| (DECL_INITIAL (DECL) != error_mark_node \
&& !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
if (! DECL_READONLY_SECTION (DECL, RELOC)) \
data_section (); \
else \
const_section (); \