diff options
author | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-07 15:32:26 +0000 |
---|---|---|
committer | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-07 15:32:26 +0000 |
commit | 00753f6a6a574bb651d47232fa4216083c92fcf0 (patch) | |
tree | a405d30c79ee348e52efd917f46d0970efe9711c /gcc | |
parent | 892e3b6fd7c089a3de8bfead09da82e8a0bddbdd (diff) | |
download | gcc-00753f6a6a574bb651d47232fa4216083c92fcf0.tar.gz |
Fix -membedded-data bug found by mips16 port.
* mips/mips.h (ENCODE_SECTION_INFO): Handle TARGET_EMBEDDED_DATA.
Add comment.
* mips/mips.c (mips_select_section): Add comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24158 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 11 | ||||
-rw-r--r-- | gcc/config/mips/mips.h | 26 |
3 files changed, 40 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2811fe1ad8..bb4d0e453a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Mon Dec 7 15:27:09 1998 DJ Delorie <dj@cygnus.com> + + * mips/mips.h (ENCODE_SECTION_INFO): Handle TARGET_EMBEDDED_DATA. + Add comment. + * mips/mips.c (mips_select_section): Add comment. + Mon Dec 7 17:55:06 1998 Mike Stump <mrs@wrs.com> * cccp.c (ignore_escape_flag): Add support for \ as `natural' diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index f8b30660703..cf6ec559672 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6861,7 +6861,16 @@ mips_select_rtx_section (mode, x) } /* Choose the section to use for DECL. RELOC is true if its value contains - any relocatable expression. */ + any relocatable expression. + + Some of the logic used here needs to be replicated in + ENCODE_SECTION_INFO in mips.h so that references to these symbols + are done correctly. Specifically, at least all symbols assigned + here to rom (.text and/or .rodata) must not be referenced via + ENCODE_SECTION_INFO with %gprel, as the rom might be too far away. + + If you need to make a change here, you probably should check + ENCODE_SECTION_INFO to see if it needs a similar change. */ void mips_select_section (decl, reloc) diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 13f1b7bd227..edf6399f3bd 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3080,7 +3080,19 @@ typedef struct mips_args { gp addresable section, SYMBOL_REF_FLAG is set prevent gcc from splitting the reference so that gas can generate a gp relative reference. - */ + + When TARGET_EMBEDDED_DATA is set, we assume that all const + variables will be stored in ROM, which is too far from %gp to use + %gprel addressing. Note that (1) we include "extern const" + variables in this, which mips_select_section doesn't, and (2) we + can't always tell if they're really const (they might be const C++ + objects with non-const constructors), so we err on the side of + caution and won't use %gprel anyway (otherwise we'd have to defer + this decision to the linker/loader). The handling of extern consts + is why the DECL_INITIAL macros differ from mips_select_section. + + If you are changing this macro, you should look at + mips_select_section and see if it needs a similar change. */ #define ENCODE_SECTION_INFO(DECL) \ do \ @@ -3094,7 +3106,17 @@ do \ mips_string_length += TREE_STRING_LENGTH (DECL); \ } \ } \ - if (TARGET_EMBEDDED_PIC) \ + \ + if (TARGET_EMBEDDED_DATA \ + && (TREE_CODE (DECL) == VAR_DECL \ + && TREE_READONLY (DECL) && !TREE_SIDE_EFFECTS (DECL)) \ + && (!DECL_INITIAL (DECL) \ + || TREE_CONSTANT (DECL_INITIAL (DECL)))) \ + { \ + SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 0; \ + } \ + \ + else if (TARGET_EMBEDDED_PIC) \ { \ if (TREE_CODE (DECL) == VAR_DECL) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ |