/* tc-i386.h -- Header file for tc-i386.c
- Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1989-2020 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#define ELF_TARGET_FORMAT "elf32-i386-nacl"
#define ELF_TARGET_FORMAT32 "elf32-x86-64-nacl"
#define ELF_TARGET_FORMAT64 "elf64-x86-64-nacl"
+#elif defined TE_CLOUDABI
+#define ELF_TARGET_FORMAT64 "elf64-x86-64-cloudabi"
#endif
#ifdef TE_SOLARIS
#define ELF_TARGET_K1OM_FORMAT "elf64-k1om"
#endif
+#ifndef ELF_TARGET_IAMCU_FORMAT
+#define ELF_TARGET_IAMCU_FORMAT "elf32-iamcu"
+#endif
+
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
|| defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
|| defined (TE_PE) || defined (TE_PEP) || defined (OBJ_MACH_O))
#endif
#endif
-#if (defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF))
-#define md_end i386_elf_emit_arch_note
-extern void i386_elf_emit_arch_note (void);
-#endif
-
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
/* '$' may be used as immediate prefix. */
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined (LEX_AT)
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES)
#endif
-extern void x86_cons (expressionS *, int);
+extern bfd_reloc_code_real_type x86_cons (expressionS *, int);
-#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_cons_fix_new(FRAG, OFF, LEN, EXP)
+#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC) \
+ x86_cons_fix_new(FRAG, OFF, LEN, EXP, RELOC)
extern void x86_cons_fix_new
- (fragS *, unsigned int, unsigned int, expressionS *);
+(fragS *, unsigned int, unsigned int, expressionS *, bfd_reloc_code_real_type);
+
+#define TC_ADDRESS_BYTES x86_address_bytes
+extern int x86_address_bytes (void);
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
the .o file. GOTOFF and GOT32 do not need to be checked here because
they are not pcrel. .*/
-#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
- || (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \
- || (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
- || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL \
- || TC_FORCE_RELOCATION (FIX))
+#define TC_FORCE_RELOCATION_LOCAL(FIX) \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
+ || (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \
+ || (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL \
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX \
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX)
+
+#define TC_FORCE_RELOCATION_ABS(FIX) \
+ (TC_FORCE_RELOCATION (FIX) \
+ || (FIX)->fx_r_type == BFD_RELOC_386_GOT32 \
+ || (FIX)->fx_r_type == BFD_RELOC_386_GOT32X \
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL \
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX \
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX)
extern int i386_parse_name (char *, expressionS *, char *);
#define md_parse_name(s, e, m, c) i386_parse_name (s, e, c)
goto around; \
}
-#define MAX_MEM_FOR_RS_ALIGN_CODE 31
+#define MAX_MEM_FOR_RS_ALIGN_CODE (alignment ? ((1 << alignment) - 1) : 1)
-extern void i386_align_code (fragS *, int);
-
-#define HANDLE_ALIGN(fragP) \
-if (fragP->fr_type == rs_align_code) \
- i386_align_code (fragP, (fragP->fr_next->fr_address \
- - fragP->fr_address \
- - fragP->fr_fix));
+extern void i386_cons_align (int);
+#define md_cons_align(nbytes) i386_cons_align (nbytes)
void i386_print_statistics (FILE *);
#define tc_print_statistics i386_print_statistics
extern unsigned int i386_frag_max_var (fragS *);
#define md_frag_max_var i386_frag_max_var
+extern long i386_generic_table_relax_frag (segT, fragS *, long);
+#define md_generic_table_relax_frag(segment, fragP, stretch) \
+ i386_generic_table_relax_frag (segment, fragP, stretch)
+
#define md_number_to_chars number_to_chars_littleendian
enum processor_type
PROCESSOR_COREI7,
PROCESSOR_L1OM,
PROCESSOR_K1OM,
+ PROCESSOR_IAMCU,
PROCESSOR_K6,
PROCESSOR_ATHLON,
PROCESSOR_K8,
PROCESSOR_GENERIC32,
PROCESSOR_GENERIC64,
PROCESSOR_AMDFAM10,
- PROCESSOR_BD
+ PROCESSOR_BD,
+ PROCESSOR_ZNVER,
+ PROCESSOR_BT
};
extern enum processor_type cpu_arch_tune;
struct i386_tc_frag_data
{
+ union
+ {
+ fragS *padding_fragP;
+ fragS *branch_fragP;
+ } u;
+ addressT padding_address;
enum processor_type isa;
i386_cpu_flags isa_flags;
enum processor_type tune;
+ unsigned int max_bytes;
+ unsigned char length;
+ unsigned char last_length;
+ unsigned char max_prefix_length;
+ unsigned char prefix_length;
+ unsigned char default_prefix;
+ unsigned char cmp_size;
+ unsigned int mf_type : 3;
+ unsigned int classified : 1;
+ unsigned int branch_type : 3;
};
/* We need to emit the right NOP pattern in .align frags. This is
the isa/tune settings at the time the .align was assembled. */
#define TC_FRAG_TYPE struct i386_tc_frag_data
-#define TC_FRAG_INIT(FRAGP) \
+#define TC_FRAG_INIT(FRAGP, MAX_BYTES) \
do \
{ \
+ (FRAGP)->tc_frag_data.u.padding_fragP = NULL; \
+ (FRAGP)->tc_frag_data.padding_address = 0; \
(FRAGP)->tc_frag_data.isa = cpu_arch_isa; \
(FRAGP)->tc_frag_data.isa_flags = cpu_arch_isa_flags; \
(FRAGP)->tc_frag_data.tune = cpu_arch_tune; \
+ (FRAGP)->tc_frag_data.max_bytes = (MAX_BYTES); \
+ (FRAGP)->tc_frag_data.length = 0; \
+ (FRAGP)->tc_frag_data.last_length = 0; \
+ (FRAGP)->tc_frag_data.max_prefix_length = 0; \
+ (FRAGP)->tc_frag_data.prefix_length = 0; \
+ (FRAGP)->tc_frag_data.default_prefix = 0; \
+ (FRAGP)->tc_frag_data.cmp_size = 0; \
+ (FRAGP)->tc_frag_data.classified = 0; \
+ (FRAGP)->tc_frag_data.branch_type = 0; \
+ (FRAGP)->tc_frag_data.mf_type = 0; \
} \
while (0)
-#ifdef SCO_ELF
-#define tc_init_after_args() sco_id ()
-extern void sco_id (void);
-#endif
-
#define WORKING_DOT_WORD 1
+/* How to generate NOPs for .nop direct directive. */
+extern void i386_generate_nops (fragS *, char *, offsetT, int);
+#define md_generate_nops(frag, where, amount, control) \
+ i386_generate_nops ((frag), (where), (amount), (control))
+
+#define HANDLE_ALIGN(fragP) \
+if (fragP->fr_type == rs_align_code) \
+ { \
+ offsetT __count = (fragP->fr_next->fr_address \
+ - fragP->fr_address \
+ - fragP->fr_fix); \
+ if (__count > 0 \
+ && (unsigned int) __count <= fragP->tc_frag_data.max_bytes) \
+ md_generate_nops (fragP, fragP->fr_literal + fragP->fr_fix, \
+ __count, 0); \
+ }
+
/* We want .cfi_* pseudo-ops for generating unwind info. */
#define TARGET_USE_CFIPOP 1
/* Support for SHF_X86_64_LARGE */
extern bfd_vma x86_64_section_word (char *, size_t);
-extern bfd_vma x86_64_section_letter (int, char **);
+extern bfd_vma x86_64_section_letter (int, const char **);
#define md_elf_section_letter(LETTER, PTR_MSG) x86_64_section_letter (LETTER, PTR_MSG)
#define md_elf_section_word(STR, LEN) x86_64_section_word (STR, LEN)
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+extern void x86_cleanup (void);
+#define md_cleanup() x86_cleanup ()
+#endif
+
#ifdef TE_PE
#define O_secrel O_md1