Commit 13bd191d by Philip Blundell Committed by Nick Clifton

Apply patch from Philip Blundell <pb@nexus.co.uk> to fix PIC support for

constant tables.

From-SVN: r27100
parent ed4e4c74
Thu May 13 09:35:51 1999 Philip Blundell <pb@nexus.co.uk>
Based on patch by Scott Bambrough and Pat Beirne:
* config/arm/arm.c (making_const_table): New variable.
* config/arm/arm.h (making_const_table): Declare.
(OUTPUT_INT_ADDR_CONST): Mark symbols as position independent if
appropriate.
* config/arm/arm.md (consttable_4, consttable_8, consttable_end):
Keep track of when we are building the constant table.
Tue May 18 17:44:22 1999 Philip Blundell <pb@nexus.co.uk> Tue May 18 17:44:22 1999 Philip Blundell <pb@nexus.co.uk>
* config/arm/arm.c (arm_override_options): Fix erroneous warning * config/arm/arm.c (arm_override_options): Fix erroneous warning
......
...@@ -70,6 +70,9 @@ static void emit_sfm PROTO ((int, int)); ...@@ -70,6 +70,9 @@ static void emit_sfm PROTO ((int, int));
static enum arm_cond_code get_arm_condition_code PROTO ((rtx)); static enum arm_cond_code get_arm_condition_code PROTO ((rtx));
static int const_ok_for_op RTX_CODE_PROTO ((Hint, Rcode)); static int const_ok_for_op RTX_CODE_PROTO ((Hint, Rcode));
/* True if we are currently building a constant table. */
int making_const_table;
/* Define the information needed to generate branch insns. This is /* Define the information needed to generate branch insns. This is
stored from the compare operation. */ stored from the compare operation. */
rtx arm_compare_op0, arm_compare_op1; rtx arm_compare_op0, arm_compare_op1;
...@@ -277,7 +280,7 @@ arm_override_options () ...@@ -277,7 +280,7 @@ arm_override_options ()
if (ptr->string != NULL && ptr->string[0] != '\0') if (ptr->string != NULL && ptr->string[0] != '\0')
{ {
struct processors * sel; const struct processors * sel;
for (sel = ptr->processors; sel->name != NULL; sel ++) for (sel = ptr->processors; sel->name != NULL; sel ++)
if (streq (ptr->string, sel->name)) if (streq (ptr->string, sel->name))
......
...@@ -1800,7 +1800,11 @@ extern int arm_pic_register; ...@@ -1800,7 +1800,11 @@ extern int arm_pic_register;
(! symbol_mentioned_p (X) \ (! symbol_mentioned_p (X) \
&& (! CONSTANT_POOL_ADDRESS_P (X) \ && (! CONSTANT_POOL_ADDRESS_P (X) \
|| ! symbol_mentioned_p (get_pool_constant (X)))) || ! symbol_mentioned_p (get_pool_constant (X))))
/* We need to know when we are making a constant pool; this determines
whether data needs to be in the GOT or can be referenced via a GOT
offset. */
extern int making_const_table;
/* Condition code information. */ /* Condition code information. */
...@@ -2019,20 +2023,33 @@ extern struct rtx_def *arm_compare_op0, *arm_compare_op1; ...@@ -2019,20 +2023,33 @@ extern struct rtx_def *arm_compare_op0, *arm_compare_op1;
GET_CODE (X) == POST_DEC ? "-" : "", \ GET_CODE (X) == POST_DEC ? "-" : "", \
GET_MODE_SIZE (output_memory_reference_mode)); \ GET_MODE_SIZE (output_memory_reference_mode)); \
} \ } \
else output_addr_const(STREAM, X); \ else output_addr_const (STREAM, X); \
\
/* Mark symbols as position independent. We only do this in the \
.text segment, not in the .data segment. */ \
if (NEED_PLT_GOT && flag_pic && making_const_table && \
(GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF)) \
{ \
if (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X)) \
fprintf (STREAM, "(GOTOFF)"); \
else if (GET_CODE (X) == LABEL_REF) \
fprintf (STREAM, "(GOTOFF)"); \
else \
fprintf (STREAM, "(GOT)"); \
} \
} }
/* Handles PIC addr specially */ /* Handles PIC addr specially */
#define OUTPUT_INT_ADDR_CONST(STREAM,X) \ #define OUTPUT_INT_ADDR_CONST(STREAM,X) \
{ \ { \
if (flag_pic && GET_CODE(X) == CONST && is_pic(X)) \ if (flag_pic && GET_CODE (X) == CONST && is_pic (X)) \
{ \ { \
output_addr_const(STREAM, XEXP (XEXP (XEXP (X, 0), 0), 0)); \ output_addr_const (STREAM, XEXP (XEXP (XEXP (X, 0), 0), 0)); \
fputs(" - (", STREAM); \ fputs (" - (", STREAM); \
output_addr_const(STREAM, XEXP (XEXP (XEXP (X, 0), 1), 0)); \ output_addr_const (STREAM, XEXP (XEXP (XEXP (X, 0), 1), 0)); \
fputs(")", STREAM); \ fputs (")", STREAM); \
} \ } \
else output_addr_const(STREAM, X); \ else output_addr_const (STREAM, X); \
} }
/* Output code to add DELTA to the first argument, and then jump to FUNCTION. /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
...@@ -2042,7 +2059,7 @@ do { \ ...@@ -2042,7 +2059,7 @@ do { \
int mi_delta = (DELTA); \ int mi_delta = (DELTA); \
char *mi_op = mi_delta < 0 ? "sub" : "add"; \ char *mi_op = mi_delta < 0 ? "sub" : "add"; \
int shift = 0; \ int shift = 0; \
int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) \ int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION)))\
? 1 : 0); \ ? 1 : 0); \
if (mi_delta < 0) mi_delta = -mi_delta; \ if (mi_delta < 0) mi_delta = -mi_delta; \
while (mi_delta != 0) \ while (mi_delta != 0) \
......
...@@ -6216,6 +6216,7 @@ ...@@ -6216,6 +6216,7 @@
"" ""
"* "*
{ {
making_const_table = TRUE;
switch (GET_MODE_CLASS (GET_MODE (operands[0]))) switch (GET_MODE_CLASS (GET_MODE (operands[0])))
{ {
case MODE_FLOAT: case MODE_FLOAT:
...@@ -6238,6 +6239,7 @@ ...@@ -6238,6 +6239,7 @@
"" ""
"* "*
{ {
making_const_table = TRUE;
switch (GET_MODE_CLASS (GET_MODE (operands[0]))) switch (GET_MODE_CLASS (GET_MODE (operands[0])))
{ {
case MODE_FLOAT: case MODE_FLOAT:
...@@ -6259,7 +6261,7 @@ ...@@ -6259,7 +6261,7 @@
[(unspec_volatile [(const_int 0)] 4)] [(unspec_volatile [(const_int 0)] 4)]
"" ""
"* "*
/* Nothing to do (currently). */ making_const_table = FALSE;
return \"\"; return \"\";
") ")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment