From 6d4d30bb14cca96f185a5cac3642560826b7e523 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 17 May 1999 03:21:46 +0000 Subject: [PATCH] / Move bitfield overflow checks to after the md_apply_fix call in fixup_segment so that md_apply_fix has a chance to modify value. Handle 8 and 16-bit pcrel relocs for i386. Prototypes and other minor code cleanups. --- gas/expr.c | 4 ++++ gas/hash.h | 2 +- gas/read.c | 14 +++++++++++--- gas/write.c | 43 ++++++++++++++++++++++--------------------- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/gas/expr.c b/gas/expr.c index d5d55fd3e6e..b49720c134f 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -34,6 +34,10 @@ #include "obstack.h" static void floating_constant PARAMS ((expressionS * expressionP)); +static valueT generic_bignum_to_int32 PARAMS ((void)); +#ifdef BFD64 +static valueT generic_bignum_to_int64 PARAMS ((void)); +#endif static void integer_constant PARAMS ((int radix, expressionS * expressionP)); static void mri_char_constant PARAMS ((expressionS *)); static void current_location PARAMS ((expressionS *)); diff --git a/gas/hash.h b/gas/hash.h index fb229c8086a..98eb3475225 100644 --- a/gas/hash.h +++ b/gas/hash.h @@ -42,4 +42,4 @@ void hash_print_statistics PARAMS ((FILE *, const char *, struct hash_control *)); #endif /* #ifdef hashH */ -/* end of hash.c */ +/* end of hash.h */ diff --git a/gas/read.c b/gas/read.c index 7fee24161eb..abee749b5d5 100644 --- a/gas/read.c +++ b/gas/read.c @@ -211,7 +211,15 @@ static void cons_worker PARAMS ((int, int)); static int scrub_from_string PARAMS ((char **)); static void do_align PARAMS ((int, char *, int, int)); static void s_align PARAMS ((int, int)); +static void s_lcomm_internal PARAMS ((int, int)); static int hex_float PARAMS ((int, char *)); +static inline int sizeof_sleb128 PARAMS ((offsetT)); +static inline int sizeof_uleb128 PARAMS ((valueT)); +static inline int output_sleb128 PARAMS ((char *, offsetT)); +static inline int output_uleb128 PARAMS ((char *, valueT)); +static inline int output_big_sleb128 PARAMS ((char *, LITTLENUM_TYPE *, int)); +static inline int output_big_uleb128 PARAMS ((char *, LITTLENUM_TYPE *, int)); +static int output_big_leb128 PARAMS ((char *, LITTLENUM_TYPE *, int, int)); static void do_org PARAMS ((segT, expressionS *, int)); char *demand_copy_string PARAMS ((int *lenP)); static segT get_segmented_expression PARAMS ((expressionS *expP)); @@ -4207,7 +4215,7 @@ output_leb128 (p, value, sign) we don't output for NULL values of P. It isn't really as critical as for "normal" values that this be streamlined. */ -static int +static inline int output_big_sleb128 (p, bignum, size) char *p; LITTLENUM_TYPE *bignum; @@ -4253,7 +4261,7 @@ output_big_sleb128 (p, bignum, size) return p - orig; } -static int +static inline int output_big_uleb128 (p, bignum, size) char *p; LITTLENUM_TYPE *bignum; @@ -4295,7 +4303,7 @@ output_big_uleb128 (p, bignum, size) return p - orig; } -static inline int +static int output_big_leb128 (p, bignum, size, sign) char *p; LITTLENUM_TYPE *bignum; diff --git a/gas/write.c b/gas/write.c index 18e6e103f94..13f78b9ebe8 100644 --- a/gas/write.c +++ b/gas/write.c @@ -2707,6 +2707,27 @@ fixup_segment (fixP, this_segment_type) } } + if (!fixP->fx_done) + { +#ifdef MD_APPLY_FIX3 + md_apply_fix3 (fixP, &add_number, this_segment_type); +#else +#ifdef BFD_ASSEMBLER + md_apply_fix (fixP, &add_number); +#else + md_apply_fix (fixP, add_number); +#endif +#endif + +#ifndef TC_HANDLES_FX_DONE + /* If the tc-* files haven't been converted, assume it's handling + it the old way, where a null fx_addsy means that the fix has + been applied completely, and no further work is needed. */ + if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0) + fixP->fx_done = 1; +#endif + } + if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0) { if ((size_t) size < sizeof (valueT)) @@ -2755,26 +2776,6 @@ fixup_segment (fixP, this_segment_type) #endif } /* not a bit fix */ - if (!fixP->fx_done) - { -#ifdef MD_APPLY_FIX3 - md_apply_fix3 (fixP, &add_number, this_segment_type); -#else -#ifdef BFD_ASSEMBLER - md_apply_fix (fixP, &add_number); -#else - md_apply_fix (fixP, add_number); -#endif -#endif - -#ifndef TC_HANDLES_FX_DONE - /* If the tc-* files haven't been converted, assume it's handling - it the old way, where a null fx_addsy means that the fix has - been applied completely, and no further work is needed. */ - if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0) - fixP->fx_done = 1; -#endif - } #ifdef TC_VALIDATE_FIX skip: ; #endif @@ -2824,7 +2825,7 @@ void write_print_statistics (file) FILE *file; { - fprintf (stderr, "fixups: %d\n", n_fixups); + fprintf (file, "fixups: %d\n", n_fixups); } /* for debugging */ -- 2.30.2