These are only used by dlx and ns32k.
* write.h: Don't include bit_fix.h.
(struct fix): Rearrange some fields. Delete fx_im_disp and
fx_bit_fixP. Use bitfields for fx_size and fx_pcrel_adjust.
* write.c (fix_new_internal): Don't init fx_im_disp and fx_bit_fixP.
(fixup_segment): Don't exclude overflow checks on fx_bit_fixP.
(print_fixup): Don't print im_disp.
* config/tc-cris.c (md_apply_fix): Remove tests of fx_bit_fixP
and fx_im_disp.
* config/tc-dlx.c (md_apply_fix): Remove wrong debug code. Set
fx_no_overflow when fx_bit_fixP.
* config/tc-dlx.h: Include bit_fix.h.
(TC_FIX_TYPE, tc_fix_data, TC_INIT_FIX_DATA): Define.
* config/tc-ns32k.c (fix_new_ns32k, fix_new_ns32k_exp): Set
fx_no_overflow when bit_fixP.
* config/tc-ns32k.h (TC_FIX_TYPE): Add fx_bit_fixP and fx_im_disp.
(fix_im_disp, fix_bit_fixP): Adjust to suit.
(TC_INIT_FIX_DATA, TC_FIX_DATA_PRINT): Likewise.
+2019-04-16 Alan Modra <amodra@gmail.com>
+
+ * write.h: Don't include bit_fix.h.
+ (struct fix): Rearrange some fields. Delete fx_im_disp and
+ fx_bit_fixP. Use bitfields for fx_size and fx_pcrel_adjust.
+ * write.c (fix_new_internal): Don't init fx_im_disp and fx_bit_fixP.
+ (fixup_segment): Don't exclude overflow checks on fx_bit_fixP.
+ (print_fixup): Don't print im_disp.
+ * config/tc-cris.c (md_apply_fix): Remove tests of fx_bit_fixP
+ and fx_im_disp.
+ * config/tc-dlx.c (md_apply_fix): Remove wrong debug code. Set
+ fx_no_overflow when fx_bit_fixP.
+ * config/tc-dlx.h: Include bit_fix.h.
+ (TC_FIX_TYPE, tc_fix_data, TC_INIT_FIX_DATA): Define.
+ * config/tc-ns32k.c (fix_new_ns32k, fix_new_ns32k_exp): Set
+ fx_no_overflow when bit_fixP.
+ * config/tc-ns32k.h (TC_FIX_TYPE): Add fx_bit_fixP and fx_im_disp.
+ (fix_im_disp, fix_bit_fixP): Adjust to suit.
+ (TC_INIT_FIX_DATA, TC_FIX_DATA_PRINT): Likewise.
+
2019-04-16 Alan Modra <amodra@gmail.com>
* write.h (struct fix <fx_where>): Make unsigned.
if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
fixP->fx_done = 1;
- if (fixP->fx_bit_fixP || fixP->fx_im_disp != 0)
- {
- as_bad_where (fixP->fx_file, fixP->fx_line, _("Invalid relocation"));
- fixP->fx_done = 1;
- }
- else
- {
- /* We can't actually support subtracting a symbol. */
- if (fixP->fx_subsy != (symbolS *) NULL)
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("expression too complex"));
+ /* We can't actually support subtracting a symbol. */
+ if (fixP->fx_subsy != (symbolS *) NULL)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("expression too complex"));
- /* This operand-type is scaled. */
- if (fixP->fx_r_type == BFD_RELOC_CRIS_LAPCQ_OFFSET)
- val /= 2;
- cris_number_to_imm (buf, val, fixP->fx_size, fixP, seg);
- }
+ /* This operand-type is scaled. */
+ if (fixP->fx_r_type == BFD_RELOC_CRIS_LAPCQ_OFFSET)
+ val /= 2;
+ cris_number_to_imm (buf, val, fixP->fx_size, fixP, seg);
}
/* All relocations are relative to the location just after the fixup;
free (fixP->fx_bit_fixP);
fixP->fx_bit_fixP = NULL;
}
-#ifdef DEBUG
- else
- know ((fixP->fx_bit_fixP != NULL));
-#endif
break;
case RELOC_DLX_HI16:
free (fixP->fx_bit_fixP);
fixP->fx_bit_fixP = NULL;
}
-#ifdef DEBUG
- else
- know ((fixP->fx_bit_fixP != NULL));
-#endif
break;
case RELOC_DLX_REL26:
free (fixP->fx_bit_fixP);
fixP->fx_bit_fixP = NULL;
}
-#ifdef DEBUG
- else
- know ((fixP->fx_bit_fixP != NULL));
-#endif
break;
case BFD_RELOC_VTABLE_INHERIT:
number_to_chars_bigendian (place, val, fixP->fx_size);
if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
+ if (fixP->fx_bit_fixP != NULL)
+ fixP->fx_no_overflow = 1;
}
const char *md_shortopts = "";
#define LEX_DOLLAR 1
+#include "bit_fix.h"
+
+#define TC_FIX_TYPE bit_fixS *
+#define tc_fix_data fx_bit_fixP
+#define TC_INIT_FIX_DATA(FIX) do (FIX)->fx_bit_fixP = NULL; while (0)
+
extern void dlx_pop_insert (void);
extern int dlx_unrecognized_line (int);
extern bfd_boolean md_dlx_fix_adjustable (struct fix *);
fix_bsr (fixP) = bsr;
fix_bit_fixP (fixP) = bit_fixP;
/* We have a MD overflow check for displacements. */
- fixP->fx_no_overflow = (im_disp != 0);
+ fixP->fx_no_overflow = im_disp != 0 || bit_fixP != NULL;
}
static void
fix_bsr (fixP) = bsr;
fix_bit_fixP (fixP) = bit_fixP;
/* We have a MD overflow check for displacements. */
- fixP->fx_no_overflow = (im_disp != 0);
+ fixP->fx_no_overflow = im_disp != 0 || bit_fixP != NULL;
}
/* Convert number to chars in correct order. */
struct \
{ \
fragS * opcode_fragP; \
+ bit_fixS * fx_bit_fixP; \
unsigned int opcode_offset; \
unsigned int bsr : 1; \
+ unsigned int fx_im_disp : 2; \
}
/* Accessor macros for things which may move around.
See comments in write.h. */
-#define fix_im_disp(X) (X)->fx_im_disp
-#define fix_bit_fixP(X) (X)->fx_bit_fixP
+#define fix_im_disp(X) (X)->tc_fix_data.fx_im_disp
+#define fix_bit_fixP(X) (X)->tc_fix_data.fx_bit_fixP
#define fix_opcode_frag(X) (X)->tc_fix_data.opcode_fragP
#define fix_opcode_offset(X) (X)->tc_fix_data.opcode_offset
#define fix_bsr(X) (X)->tc_fix_data.bsr
{ \
fix_opcode_frag(X) = NULL; \
fix_opcode_offset(X) = 0; \
+ fix_bit_fixP(X) = NULL; \
fix_bsr(X) = 0; \
+ fix_im_disp(X) = 0; \
} \
while (0)
#define TC_FIX_DATA_PRINT(FILE, FIX) \
do \
{ \
- fprintf ((FILE), "opcode_frag=%ld, operand offset=%d, bsr=%d\n", \
- (unsigned long) fix_opcode_frag (FIX), \
- fix_opcode_offset (FIX), \
- fix_bsr (FIX)); \
+ fprintf ((FILE), "opcode_frag=%ld, operand offset=%d, bsr=%d, " \
+ "im_disp=%d\n", \
+ (unsigned long) fix_opcode_frag (FIX), \
+ fix_opcode_offset (FIX), \
+ fix_bsr (FIX), \
+ fix_im_disp (FIX)); \
} \
while (0)
fixP->fx_dot_frag = dot_frag;
fixP->fx_pcrel = pcrel;
fixP->fx_r_type = r_type;
- fixP->fx_im_disp = 0;
fixP->fx_pcrel_adjust = 0;
- fixP->fx_bit_fixP = 0;
fixP->fx_addnumber = 0;
fixP->fx_tcbit = 0;
fixP->fx_tcbit2 = 0;
symbol_mark_used_in_reloc (fixP->fx_subsy);
}
- if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && fixP->fx_size != 0)
+ if (!fixP->fx_no_overflow && fixP->fx_size != 0)
{
if (fixP->fx_size < sizeof (valueT))
{
(long) add_number,
(long) (fragP->fr_address + fixP->fx_where));
#endif
- } /* Not a bit fix. */
+ }
#ifdef TC_VALIDATE_FIX
skip: ATTRIBUTE_UNUSED_LABEL
fprintf (stderr, " pcrel");
if (fixp->fx_pcrel_adjust)
fprintf (stderr, " pcrel_adjust=%d", fixp->fx_pcrel_adjust);
- if (fixp->fx_im_disp)
- {
-#ifdef TC_NS32K
- fprintf (stderr, " im_disp=%d", fixp->fx_im_disp);
-#else
- fprintf (stderr, " im_disp");
-#endif
- }
if (fixp->fx_tcbit)
fprintf (stderr, " tcbit");
if (fixp->fx_done)
#define FAKE_LABEL_CHAR '\001'
#endif
-#include "bit_fix.h"
-
/*
* FixSs may be built up in any order.
*/
struct fix
{
+ /* Next fixS in linked list, or NULL. */
+ struct fix *fx_next;
+
/* These small fields are grouped together for compactness of
this structure, and efficiency of access on some architectures. */
/* Is this a pc-relative relocation? */
unsigned fx_pcrel : 1;
- /* Is this value an immediate displacement? */
- /* Only used on ns32k; merge it into TC_FIX_TYPE sometime. */
- unsigned fx_im_disp : 2;
-
- /* Some bits for the CPU specific code. */
- unsigned fx_tcbit : 1;
- unsigned fx_tcbit2 : 1;
-
/* Has this relocation already been applied? */
unsigned fx_done : 1;
/* The value is signed when checking for overflow. */
unsigned fx_signed : 1;
+ /* Some bits for the CPU specific code. */
+ unsigned fx_tcbit : 1;
+ unsigned fx_tcbit2 : 1;
+
+ /* Spare bits. */
+ unsigned fx_unused : 10;
+
/* pc-relative offset adjust (only used by some CPU specific code) */
- signed char fx_pcrel_adjust;
+ int fx_pcrel_adjust : 8;
/* How many bytes are involved? */
- unsigned char fx_size;
+ unsigned fx_size : 8;
+
+ bfd_reloc_code_real_type fx_r_type;
/* Which frag does this fix apply to? */
fragS *fx_frag;
/* The frag fx_dot_value is based on. */
fragS *fx_dot_frag;
- /* Next fixS in linked list, or NULL. */
- struct fix *fx_next;
-
- /* If NULL, no bitfix's to do. */
- bit_fixS *fx_bit_fixP;
-
- bfd_reloc_code_real_type fx_r_type;
-
/* This field is sort of misnamed. It appears to be a sort of random
scratch field, for use by the back ends. The main gas code doesn't
do anything but initialize it to zero. The use of it does need to