aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@cygnus.com>1999-05-07 12:42:05 +0000
committerJim Wilson <wilson@gcc.gnu.org>1999-05-07 05:42:05 -0700
commit52ecdfda6590bc24e48db6bbe0cf210d39c26572 (patch)
tree110a889cd2f0a819c32ee9bba382c790225620c8
parente42dc6049611fc5a9c3b44eba7a7fecf87393a9f (diff)
downloadgcc-52ecdfda6590bc24e48db6bbe0cf210d39c26572.zip
gcc-52ecdfda6590bc24e48db6bbe0cf210d39c26572.tar.gz
gcc-52ecdfda6590bc24e48db6bbe0cf210d39c26572.tar.bz2
Fix mips16 libstdc++ builds. Fix inconsistency from Apr 7 change.
* mips/elf64.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define. * mips/mips.c (mips_select_rtx_section): When TARGET_MIPS16, use function_section instead of text_section. * mips/mips.h (ENCODE_SECTION_INFO): Add check for UNIQUE_SECTION_P in TARGET_MIPS16 STRING_CST handling. From-SVN: r26824
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/mips/elf64.h2
-rw-r--r--gcc/config/mips/mips.c6
-rw-r--r--gcc/config/mips/mips.h15
4 files changed, 27 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e1c6523..d33a850 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Fri May 7 12:38:54 1999 Jim Wilson <wilson@cygnus.com>
+
+ * mips/elf64.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define.
+ * mips/mips.c (mips_select_rtx_section): When TARGET_MIPS16, use
+ function_section instead of text_section.
+ * mips/mips.h (ENCODE_SECTION_INFO): Add check for UNIQUE_SECTION_P
+ in TARGET_MIPS16 STRING_CST handling.
+
Fri May 7 09:54:11 1999 Nick Clifton <nickc@cygnus.com>
Patch from: Nick Burrett <nick.burrett@btinternet.com>
diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h
index cb02f9c..d692531 100644
--- a/gcc/config/mips/elf64.h
+++ b/gcc/config/mips/elf64.h
@@ -195,6 +195,8 @@ do { \
fputc ('\n', FILE); \
} while (0)
+#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#define UNIQUE_SECTION(DECL,RELOC) \
do { \
int len, size, sec; \
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index a4b38e1..20caaa4 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -6884,10 +6884,10 @@ mips_select_rtx_section (mode, x)
{
if (TARGET_MIPS16)
{
- /* In mips16 mode, the constant table always goes in the .text
- section, so that constants can be loaded using PC relative
+ /* In mips16 mode, the constant table always goes in the same section
+ as the function, so that constants can be loaded using PC relative
addressing. */
- text_section ();
+ function_section (current_function_decl);
}
else if (TARGET_EMBEDDED_DATA)
{
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 75ee865..08b78b8 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3168,7 +3168,20 @@ do \
if (TARGET_MIPS16) \
{ \
if (TREE_CODE (DECL) == STRING_CST \
- && ! flag_writable_strings) \
+ && ! flag_writable_strings \
+ /* If this string is from a function, and the function will \
+ go in a gnu linkonce section, then we can't directly \
+ access the string. This gets an assembler error \
+ "unsupported PC relative reference to different section".\
+ If we modify SELECT_SECTION to put it in function_section\
+ instead of text_section, it still fails because \
+ DECL_SECTION_NAME isn't set until assemble_start_function.\
+ If we fix that, it still fails because strings are shared\
+ among multiple functions, and we have cross section \
+ references again. We force it to work by putting string \
+ addresses in the constant pool and indirecting. */ \
+ && (! current_function_decl \
+ || ! UNIQUE_SECTION_P (current_function_decl))) \
{ \
SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \
mips_string_length += TREE_STRING_LENGTH (DECL); \