From 83e6e822b68e492d4d2dfd09ec610569f0447ea7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 19 Sep 2002 23:51:35 +0000 Subject: [PATCH] * write.h (struct fix): Add fx_dot_value. (dot_value): Declare. * write.c (dot_value): New var. (fix_new_internal): Save dot_value as fx_dot_value. * expr.c (expr): Update dot_value. --- gas/ChangeLog | 8 ++++++++ gas/expr.c | 4 ++++ gas/write.c | 7 ++++++- gas/write.h | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 17a9ce0f98..7a2340704c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2002-09-20 Alan Modra + + * write.h (struct fix): Add fx_dot_value. + (dot_value): Declare. + * write.c (dot_value): New var. + (fix_new_internal): Save dot_value as fx_dot_value. + * expr.c (expr): Update dot_value. + 2002-09-19 Jakub Jelinek * config/tc-i386.c (tc_i386_fix_adjustable): Handle diff --git a/gas/expr.c b/gas/expr.c index 64c92cae34..b8e49f5156 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -1657,6 +1657,10 @@ expr (rankarg, resultP) know (rank >= 0); + /* Save the value of dot for the fixup code. */ + if (rank == 0) + dot_value = frag_now_fix (); + retval = operand (resultP); /* operand () gobbles spaces. */ diff --git a/gas/write.c b/gas/write.c index 17c323209f..4ee6a7d6a0 100644 --- a/gas/write.c +++ b/gas/write.c @@ -111,6 +111,9 @@ int symbol_table_frozen; symbolS *abs_section_sym; +/* Remember the value of dot when parsing expressions. */ +addressT dot_value; + void print_fixup PARAMS ((fixS *)); #ifdef BFD_ASSEMBLER @@ -220,6 +223,7 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel, fixP->fx_addsy = add_symbol; fixP->fx_subsy = sub_symbol; fixP->fx_offset = offset; + fixP->fx_dot_value = dot_value; fixP->fx_pcrel = pcrel; fixP->fx_plt = 0; #if defined(NEED_FX_R_TYPE) || defined (BFD_ASSEMBLER) @@ -2656,7 +2660,8 @@ fixup_segment (fixP, this_segment) && !TC_FORCE_RELOCATION_SUB_LOCAL (fixP)) { add_number -= S_GET_VALUE (fixP->fx_subsy); - fixP->fx_offset = add_number; + fixP->fx_offset = (add_number + fixP->fx_dot_value + + fixP->fx_frag->fr_address); /* Make it pc-relative. If the back-end code has not selected a pc-relative reloc, cancel the adjustment diff --git a/gas/write.h b/gas/write.h index 3a3b585653..962ccd0fb1 100644 --- a/gas/write.h +++ b/gas/write.h @@ -105,6 +105,9 @@ struct fix /* Absolute number we add in. */ valueT fx_offset; + /* The value of dot when the fixup expression was parsed. */ + addressT fx_dot_value; + /* Next fixS in linked list, or NULL. */ struct fix *fx_next; @@ -159,6 +162,7 @@ typedef struct fix fixS; extern int finalize_syms; extern symbolS *abs_section_sym; +extern addressT dot_value; #ifndef BFD_ASSEMBLER extern char *next_object_file_charP; -- 2.11.0