i386: Align branches within a fixed boundary
[deliverable/binutils-gdb.git] / gas / config / tc-i386.h
index 5426301025cd19c21b81658802f61258b1d3d9f1..28f03cf2dbe21d64621489a136710e2db1717a9a 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-i386.h -- Header file for tc-i386.c
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -63,6 +63,8 @@ extern unsigned long i386_mach (void);
 #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
@@ -174,6 +176,7 @@ extern int tc_i386_fix_adjustable (struct 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)
 
@@ -205,7 +208,10 @@ if ((n)                                                                    \
     goto around;                                                       \
   }
 
-#define MAX_MEM_FOR_RS_ALIGN_CODE 4095
+#define MAX_MEM_FOR_RS_ALIGN_CODE  (alignment ? ((1 << alignment) - 1) : 1)
+
+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
@@ -213,6 +219,10 @@ void i386_print_statistics (FILE *);
 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
@@ -247,9 +257,24 @@ extern i386_cpu_flags cpu_arch_isa_flags;
 
 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 classified : 1;
+  unsigned int branch_type : 3;
 };
 
 /* We need to emit the right NOP pattern in .align frags.  This is
@@ -257,12 +282,23 @@ struct i386_tc_frag_data
    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;                    \
    }                                                           \
  while (0)
 
@@ -279,7 +315,8 @@ if (fragP->fr_type == rs_align_code)                                        \
     offsetT __count = (fragP->fr_next->fr_address                      \
                       - fragP->fr_address                              \
                       - fragP->fr_fix);                                \
-    if (__count > 0 && __count <= MAX_MEM_FOR_RS_ALIGN_CODE)           \
+    if (__count > 0                                                    \
+       && (unsigned int) __count <= fragP->tc_frag_data.max_bytes)     \
       md_generate_nops (fragP, fragP->fr_literal + fragP->fr_fix,      \
                        __count, 0);                                    \
   }
This page took 0.025676 seconds and 4 git commands to generate.