#define SCALE1_WHEN_NO_INDEX 1
#endif
-#ifdef BFD_ASSEMBLER
-#define RELOC_ENUM enum bfd_reloc_code_real
-#else
-#define RELOC_ENUM int
-#endif
-
#ifndef DEFAULT_ARCH
#define DEFAULT_ARCH "i386"
#endif
#define Operand_PCrel 1
/* Relocation type for operand */
- RELOC_ENUM reloc[MAX_OPERANDS];
+ enum bfd_reloc_code_real reloc[MAX_OPERANDS];
/* BASE_REG, INDEX_REG, and LOG2_SCALE_FACTOR are used to encode
the base index byte below. */
intel_syntax = syntax_flag;
if (ask_naked_reg == 0)
- {
-#ifdef BFD_ASSEMBLER
- allow_naked_reg = (intel_syntax
- && (bfd_get_symbol_leading_char (stdoutput) != '\0'));
-#else
- /* Conservative default. */
- allow_naked_reg = 0;
-#endif
- }
+ allow_naked_reg = (intel_syntax
+ && (bfd_get_symbol_leading_char (stdoutput) != '\0'));
else
allow_naked_reg = (ask_naked_reg < 0);
}
demand_empty_rest_of_line ();
}
-#ifdef BFD_ASSEMBLER
unsigned long
i386_mach ()
{
else
as_fatal (_("Unknown architecture"));
}
-#endif
\f
void
md_begin ()
#endif /* DEBUG386 */
\f
-#ifdef BFD_ASSEMBLER
static bfd_reloc_code_real_type reloc
PARAMS ((int, int, int, bfd_reloc_code_real_type));
#endif
return 1;
}
-#else
-#define reloc(SIZE,PCREL,SIGN,OTHER) 0
-#define BFD_RELOC_8 0
-#define BFD_RELOC_16 0
-#define BFD_RELOC_32 0
-#define BFD_RELOC_8_PCREL 0
-#define BFD_RELOC_16_PCREL 0
-#define BFD_RELOC_32_PCREL 0
-#define BFD_RELOC_386_PLT32 0
-#define BFD_RELOC_386_GOT32 0
-#define BFD_RELOC_386_GOTOFF 0
-#define BFD_RELOC_386_TLS_GD 0
-#define BFD_RELOC_386_TLS_LDM 0
-#define BFD_RELOC_386_TLS_LDO_32 0
-#define BFD_RELOC_386_TLS_IE_32 0
-#define BFD_RELOC_386_TLS_IE 0
-#define BFD_RELOC_386_TLS_GOTIE 0
-#define BFD_RELOC_386_TLS_LE_32 0
-#define BFD_RELOC_386_TLS_LE 0
-#define BFD_RELOC_X86_64_PLT32 0
-#define BFD_RELOC_X86_64_GOT32 0
-#define BFD_RELOC_X86_64_GOTPCREL 0
-#define BFD_RELOC_X86_64_TLSGD 0
-#define BFD_RELOC_X86_64_TLSLD 0
-#define BFD_RELOC_X86_64_DTPOFF32 0
-#define BFD_RELOC_X86_64_GOTTPOFF 0
-#define BFD_RELOC_X86_64_TPOFF32 0
-#endif
static int intel_float_operand PARAMS ((const char *mnemonic));
{
union i386_op temp_op;
unsigned int temp_type;
- RELOC_ENUM temp_reloc;
+ enum bfd_reloc_code_real temp_reloc;
int xchg1 = 0;
int xchg2 = 0;
}
else
{
- RELOC_ENUM reloc_type;
+ enum bfd_reloc_code_real reloc_type;
int size = 4;
int sign = 0;
int pcrel = (i.flags[n] & Operand_PCrel) != 0;
p = frag_more (size);
reloc_type = reloc (size, pcrel, sign, i.reloc[n]);
-#ifdef BFD_ASSEMBLER
if (reloc_type == BFD_RELOC_32
&& GOT_symbol
&& GOT_symbol == i.op[n].disps->X_add_symbol
reloc_type = BFD_RELOC_386_GOTPC;
i.op[n].disps->X_add_number += add;
}
-#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[n].disps, pcrel, reloc_type);
}
Need a 32-bit fixup (don't support 8bit
non-absolute imms). Try to support other
sizes ... */
- RELOC_ENUM reloc_type;
+ enum bfd_reloc_code_real reloc_type;
int size = 4;
int sign = 0;
p = frag_more (size);
reloc_type = reloc (size, 0, sign, i.reloc[n]);
-#ifdef BFD_ASSEMBLER
+
/* This is tough to explain. We end up with this one if we
* have operands that look like
* "_GLOBAL_OFFSET_TABLE_+[.-.L284]". The goal here is to
reloc_type = BFD_RELOC_386_GOTPC;
i.op[n].imms->X_add_number += add;
}
-#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[n].imms, 0, reloc_type);
}
}
\f
#ifndef LEX_AT
-static char *lex_got PARAMS ((RELOC_ENUM *, int *));
+static char *lex_got PARAMS ((enum bfd_reloc_code_real *, int *));
/* Parse operands of the form
<symbol>@GOTOFF+<nnn>
input line. Otherwise return NULL. */
static char *
lex_got (reloc, adjust)
- RELOC_ENUM *reloc;
+ enum bfd_reloc_code_real *reloc;
int *adjust;
{
static const char * const mode_name[NUM_FLAG_CODE] = { "32", "16", "64" };
static const struct {
const char *str;
- const RELOC_ENUM rel[NUM_FLAG_CODE];
+ const enum bfd_reloc_code_real rel[NUM_FLAG_CODE];
} gotrel[] = {
{ "PLT", { BFD_RELOC_386_PLT32, 0, BFD_RELOC_X86_64_PLT32 } },
{ "GOTOFF", { BFD_RELOC_386_GOTOFF, 0, 0 } },
/* x86_cons_fix_new is called via the expression parsing code when a
reloc is needed. We use this hook to get the correct .got reloc. */
-static RELOC_ENUM got_reloc = NO_RELOC;
+static enum bfd_reloc_code_real got_reloc = NO_RELOC;
void
x86_cons_fix_new (frag, off, len, exp)
unsigned int len;
expressionS *exp;
{
- RELOC_ENUM r = reloc (len, 0, 0, got_reloc);
+ enum bfd_reloc_code_real r = reloc (len, 0, 0, got_reloc);
got_reloc = NO_RELOC;
fix_new_exp (frag, off, len, exp, 0, r);
}
exp->X_add_number = (exp->X_add_number ^ ((addressT) 1 << 31)) - ((addressT) 1 << 31);
}
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
- else if (1
-#ifdef BFD_ASSEMBLER
- && OUTPUT_FLAVOR == bfd_target_aout_flavour
-#endif
+ else if (OUTPUT_FLAVOR == bfd_target_aout_flavour
&& exp_seg != absolute_section
&& exp_seg != text_section
&& exp_seg != data_section
&& exp_seg != bss_section
&& exp_seg != undefined_section
-#ifdef BFD_ASSEMBLER
- && !bfd_is_com_section (exp_seg)
-#endif
- )
+ && !bfd_is_com_section (exp_seg))
{
-#ifdef BFD_ASSEMBLER
as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
-#else
- as_bad (_("unimplemented segment type %d in operand"), exp_seg);
-#endif
return 0;
}
#endif
free (gotfree_input_line);
#endif
-#ifdef BFD_ASSEMBLER
/* We do this to make sure that the section symbol is in
the symbol table. We will ultimately change the relocation
to be relative to the beginning of the section. */
else
i.reloc[this_operand] = BFD_RELOC_32;
}
-#endif
if (exp->X_op == O_absent || exp->X_op == O_big)
{
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
if (exp->X_op != O_constant
-#ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour
-#endif
&& exp_seg != absolute_section
&& exp_seg != text_section
&& exp_seg != data_section
&& exp_seg != bss_section
&& exp_seg != undefined_section
-#ifdef BFD_ASSEMBLER
- && !bfd_is_com_section (exp_seg)
-#endif
- )
+ && !bfd_is_com_section (exp_seg))
{
-#ifdef BFD_ASSEMBLER
as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
-#else
- as_bad (_("unimplemented segment type %d in operand"), exp_seg);
-#endif
return 0;
}
#endif
/* Symbol is undefined in this segment, or we need to keep a
reloc so that weak symbols can be overridden. */
int size = (fragP->fr_subtype & CODE16) ? 2 : 4;
- RELOC_ENUM reloc_type;
+ enum bfd_reloc_code_real reloc_type;
unsigned char *opcode;
int old_fr_fix;
Out: Any fixSs and constants are set up.
Caller will turn frag into a ".space 0". */
-#ifndef BFD_ASSEMBLER
-void
-md_convert_frag (headers, sec, fragP)
- object_headers *headers ATTRIBUTE_UNUSED;
- segT sec ATTRIBUTE_UNUSED;
- fragS *fragP;
-#else
void
md_convert_frag (abfd, sec, fragP)
bfd *abfd ATTRIBUTE_UNUSED;
segT sec ATTRIBUTE_UNUSED;
fragS *fragP;
-#endif
{
unsigned char *opcode;
unsigned char *where_to_put_displacement = NULL;
char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
valueT value = *valP;
-#if defined (BFD_ASSEMBLER) && !defined (TE_Mach)
+#if !defined (TE_Mach)
if (fixP->fx_pcrel)
{
switch (fixP->fx_r_type)
}
#endif /* defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) */
*valP = value;
-#endif /* defined (BFD_ASSEMBLER) && !defined (TE_Mach) */
+#endif /* !defined (TE_Mach) */
/* Are we finished with this relocation now? */
if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
-#ifdef BFD_ASSEMBLER
else if (use_rela_relocations)
{
fixP->fx_no_overflow = 1;
fixP->fx_addnumber = value;
value = 0;
}
-#endif
+
md_number_to_chars (p, value, fixP->fx_size);
}
\f
#endif
}
-#ifdef BFD_ASSEMBLER
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
|| defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
}
}
#endif
-#endif /* BFD_ASSEMBLER */
\f
symbolS *
md_undefined_symbol (name)
segT segment ATTRIBUTE_UNUSED;
valueT size;
{
-#ifdef BFD_ASSEMBLER
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
if (OUTPUT_FLAVOR == bfd_target_aout_flavour)
{
align = bfd_get_section_alignment (stdoutput, segment);
size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
}
-#endif
#endif
return size;
#endif
-#ifdef BFD_ASSEMBLER
-
void
i386_validate_fix (fixp)
fixS *fixp;
return rel;
}
-#else /* !BFD_ASSEMBLER */
-
-#if (defined(OBJ_AOUT) | defined(OBJ_BOUT))
-void
-tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
- char *where;
- fixS *fixP;
- relax_addressT segment_address_in_file;
-{
- /* In: length of relocation (or of address) in chars: 1, 2 or 4.
- Out: GNU LD relocation length code: 0, 1, or 2. */
-
- static const unsigned char nbytes_r_length[] = { 42, 0, 1, 42, 2 };
- long r_symbolnum;
-
- know (fixP->fx_addsy != NULL);
-
- md_number_to_chars (where,
- (valueT) (fixP->fx_frag->fr_address
- + fixP->fx_where - segment_address_in_file),
- 4);
-
- r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy)
- ? S_GET_TYPE (fixP->fx_addsy)
- : fixP->fx_addsy->sy_number);
-
- where[6] = (r_symbolnum >> 16) & 0x0ff;
- where[5] = (r_symbolnum >> 8) & 0x0ff;
- where[4] = r_symbolnum & 0x0ff;
- where[7] = ((((!S_IS_DEFINED (fixP->fx_addsy)) << 3) & 0x08)
- | ((nbytes_r_length[fixP->fx_size] << 1) & 0x06)
- | (((fixP->fx_pcrel << 0) & 0x01) & 0x0f));
-}
-
-#endif /* OBJ_AOUT or OBJ_BOUT. */
-
-#if defined (I386COFF)
-
-short
-tc_coff_fix2rtype (fixP)
- fixS *fixP;
-{
- if (fixP->fx_r_type == R_IMAGEBASE)
- return R_IMAGEBASE;
-
- return (fixP->fx_pcrel ?
- (fixP->fx_size == 1 ? R_PCRBYTE :
- fixP->fx_size == 2 ? R_PCRWORD :
- R_PCRLONG) :
- (fixP->fx_size == 1 ? R_RELBYTE :
- fixP->fx_size == 2 ? R_RELWORD :
- R_DIR32));
-}
-
-int
-tc_coff_sizemachdep (frag)
- fragS *frag;
-{
- if (frag->fr_next)
- return (frag->fr_next->fr_address - frag->fr_address);
- else
- return 0;
-}
-
-#endif /* I386COFF */
-
-#endif /* !BFD_ASSEMBLER */
\f
/* Parse operands using Intel syntax. This implements a recursive descent
parser based on the BNF grammar published in Appendix B of the MASM 6.1
#ifndef TC_I386
#define TC_I386 1
+#ifndef BFD_ASSEMBLER
+#error So, do you know what you are doing?
+#endif
+
#ifdef ANSI_PROTOTYPES
struct fix;
#endif
#define TARGET_FORMAT "coff-i386-lynx"
#endif
-#ifdef BFD_ASSEMBLER
#define TARGET_ARCH bfd_arch_i386
#define TARGET_MACH (i386_mach ())
extern unsigned long i386_mach PARAMS ((void));
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
-#else /* ! BFD_ASSEMBLER */
-
-/* COFF STUFF */
-
-#define COFF_MAGIC I386MAGIC
-#define BFD_ARCH bfd_arch_i386
-#define COFF_FLAGS F_AR32WR
-#define TC_COUNT_RELOC(x) ((x)->fx_addsy || (x)->fx_r_type==7)
-#define TC_COFF_FIX2RTYPE(FIX) tc_coff_fix2rtype(FIX)
-extern short tc_coff_fix2rtype PARAMS ((struct fix *));
-#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep (frag)
-extern int tc_coff_sizemachdep PARAMS ((fragS *frag));
-
-#ifdef TE_GO32
-/* DJGPP now expects some sections to be 2**4 aligned. */
-#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \
- ((strcmp (obj_segment_name (SEG), ".text") == 0 \
- || strcmp (obj_segment_name (SEG), ".data") == 0 \
- || strcmp (obj_segment_name (SEG), ".bss") == 0 \
- || strncmp (obj_segment_name (SEG), ".gnu.linkonce.t", 15) == 0 \
- || strncmp (obj_segment_name (SEG), ".gnu.linkonce.d", 15) == 0 \
- || strncmp (obj_segment_name (SEG), ".gnu.linkonce.r", 15) == 0) \
- ? 4 \
- : 2)
-#else
-#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 2
-#endif
-
-#ifdef TE_386BSD
-/* The BSDI linker apparently rejects objects with a machine type of
- M_386 (100). */
-#define AOUT_MACHTYPE 0
-#else
-#define AOUT_MACHTYPE 100
-#endif
-
-#ifndef OBJ_AOUT
-#ifndef TE_PE
-#ifndef TE_GO32
-/* Local labels starts with .L */
-#define LOCAL_LABEL(name) (name[0] == '.' \
- && (name[1] == 'L' || name[1] == 'X' || name[1] == '.'))
-#endif
-#endif
-#endif
-
-#define tc_aout_pre_write_hook(x) {;} /* not used */
-#define tc_crawl_symbol_chain(a) {;} /* not used */
-#define tc_headers_hook(a) {;} /* not used */
-#define tc_coff_symbol_emit_hook(a) {;} /* not used */
-
-#endif /* ! BFD_ASSEMBLER */
-
#define LOCAL_LABELS_FB 1
extern const char extra_symbol_chars[];
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
-#ifdef BFD_ASSEMBLER
#define NO_RELOC BFD_RELOC_NONE
void i386_validate_fix PARAMS ((struct fix *));
|| (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
|| TC_FORCE_RELOCATION (FIX))
-#else /* ! BFD_ASSEMBLER */
-
-#define NO_RELOC 0
-
-#define TC_RVA_RELOC 7
-
-/* Need this for PIC relocations */
-#define NEED_FX_R_TYPE
-
-#undef REVERSE_SORT_RELOCS
-
-/* For COFF. */
-#define TC_FORCE_RELOCATION(FIX) \
- ((FIX)->fx_r_type == 7 || generic_force_reloc (FIX))
-#endif /* ! BFD_ASSEMBLER */
-
#define md_operand(x)
extern const struct relax_type md_relax_table[];