diff options
author | Jeff Law <law@gcc.gnu.org> | 1996-06-04 12:58:08 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1996-06-04 12:58:08 -0600 |
commit | c77c286a724a0aef1c008516d840953a02700274 (patch) | |
tree | c994feeff39dfc47f927fc618fe227af0a8f7e21 | |
parent | e4fa6b06f01a3b6074ff446d948e705dccf2af96 (diff) | |
download | gcc-c77c286a724a0aef1c008516d840953a02700274.zip gcc-c77c286a724a0aef1c008516d840953a02700274.tar.gz gcc-c77c286a724a0aef1c008516d840953a02700274.tar.bz2 |
pa.c (reloc_needed): New function.
* pa/pa.c (reloc_needed): New function.
* pa/pa.h (TEXT_SPACE_P): Variables/constants with initializers
requiring relocs never live in the text space.
From-SVN: r12156
-rw-r--r-- | gcc/config/pa/pa.c | 41 | ||||
-rw-r--r-- | gcc/config/pa/pa.h | 2 |
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 52375af..f2dca71 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -1182,6 +1182,47 @@ emit_move_sequence (operands, mode, scratch_reg) return 0; } +/* Examine EXP and return nonzero if it contains an ADDR_EXPR (meaning + it will need a link/runtime reloc. */ + +int +reloc_needed (exp) + tree exp; +{ + int reloc = 0; + + switch (TREE_CODE (exp)) + { + case ADDR_EXPR: + return 1; + + case PLUS_EXPR: + case MINUS_EXPR: + reloc = reloc_needed (TREE_OPERAND (exp, 0)); + reloc |= reloc_needed (TREE_OPERAND (exp, 1)); + break; + + case NOP_EXPR: + case CONVERT_EXPR: + case NON_LVALUE_EXPR: + reloc = reloc_needed (TREE_OPERAND (exp, 0)); + break; + + case CONSTRUCTOR: + { + register tree link; + for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link)) + if (TREE_VALUE (link) != 0) + reloc |= reloc_needed (TREE_VALUE (link)); + } + break; + + case ERROR_MARK: + break; + } + return reloc; +} + /* Does operand (which is a symbolic_operand) live in text space? If so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true. */ diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 1f0af0e..c1c082b 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1530,8 +1530,10 @@ extern struct rtx_def *hppa_legitimize_address (); (TREE_CODE (DECL) == FUNCTION_DECL \ || (TREE_CODE (DECL) == VAR_DECL \ && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \ + && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \ && !flag_pic) \ || (*tree_code_type[(int) TREE_CODE (DECL)] == 'c' \ + && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \ && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings))) #define FUNCTION_NAME_P(NAME) \ |