Change regcache list to be an hash map
[deliverable/binutils-gdb.git] / bfd / archures.c
index 3d61d71120469c7b00b9d2add08230595c3409a6..e8873d49687a786b3f6b31302ef77f05c2a248b1 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD library support routines for architectures.
-   Copyright (C) 1990-2018 Free Software Foundation, Inc.
+   Copyright (C) 1990-2019 Free Software Foundation, Inc.
    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -175,7 +175,9 @@ DESCRIPTION
 .#define bfd_mach_mips5                        5
 .#define bfd_mach_mips_loongson_2e     3001
 .#define bfd_mach_mips_loongson_2f     3002
-.#define bfd_mach_mips_loongson_3a     3003
+.#define bfd_mach_mips_gs464           3003
+.#define bfd_mach_mips_gs464e          3004
+.#define bfd_mach_mips_gs264e          3005
 .#define bfd_mach_mips_sb1             12310201 {* octal 'SB', 01.  *}
 .#define bfd_mach_mips_octeon          6501
 .#define bfd_mach_mips_octeonp         6601
@@ -217,11 +219,8 @@ DESCRIPTION
 .#define bfd_mach_iamcu                        (1 << 8)
 .#define bfd_mach_i386_iamcu           (bfd_mach_i386_i386 | bfd_mach_iamcu)
 .#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax)
-.  bfd_arch_we32k,     {* AT&T WE32xxx.  *}
-.  bfd_arch_i370,      {* IBM 360/370 Mainframes.  *}
 .  bfd_arch_romp,      {* IBM ROMP PC/RT.  *}
 .  bfd_arch_convex,    {* Convex.  *}
-.  bfd_arch_m88k,      {* Motorola 88xxx.  *}
 .  bfd_arch_m98k,      {* Motorola 98xxx.  *}
 .  bfd_arch_pyramid,   {* Pyramid Technology.  *}
 .  bfd_arch_h8300,     {* Renesas H8/300 (formerly Hitachi H8/300).  *}
@@ -284,10 +283,11 @@ DESCRIPTION
 .#define bfd_mach_m6812s       2
 .  bfd_arch_m9s12x,    {* Freescale S12X.  *}
 .  bfd_arch_m9s12xg,   {* Freescale XGATE.  *}
+.  bfd_arch_s12z,    {* Freescale S12Z.  *}
+.#define bfd_mach_s12z_default 0
 .  bfd_arch_z8k,       {* Zilog Z8000.  *}
 .#define bfd_mach_z8001                1
 .#define bfd_mach_z8002                2
-.  bfd_arch_h8500,     {* Renesas H8/500 (formerly Hitachi H8/500).  *}
 .  bfd_arch_sh,               {* Renesas / SuperH SH (formerly Hitachi SH).  *}
 .#define bfd_mach_sh                           1
 .#define bfd_mach_sh2                          0x20
@@ -309,7 +309,6 @@ DESCRIPTION
 .#define bfd_mach_sh4a                         0x4a
 .#define bfd_mach_sh4a_nofpu                   0x4b
 .#define bfd_mach_sh4al_dsp                    0x4d
-.#define bfd_mach_sh5                          0x50
 .  bfd_arch_alpha,     {* Dec Alpha.  *}
 .#define bfd_mach_alpha_ev4    0x10
 .#define bfd_mach_alpha_ev5    0x20
@@ -329,6 +328,20 @@ DESCRIPTION
 .#define bfd_mach_arm_ep9312   11
 .#define bfd_mach_arm_iWMMXt   12
 .#define bfd_mach_arm_iWMMXt2  13
+.#define bfd_mach_arm_5TEJ      14
+.#define bfd_mach_arm_6         15
+.#define bfd_mach_arm_6KZ       16
+.#define bfd_mach_arm_6T2       17
+.#define bfd_mach_arm_6K        18
+.#define bfd_mach_arm_7         19
+.#define bfd_mach_arm_6M        20
+.#define bfd_mach_arm_6SM       21
+.#define bfd_mach_arm_7EM       22
+.#define bfd_mach_arm_8         23
+.#define bfd_mach_arm_8R        24
+.#define bfd_mach_arm_8M_BASE   25
+.#define bfd_mach_arm_8M_MAIN   26
+.#define bfd_mach_arm_8_1M_MAIN 27
 .  bfd_arch_nds32,     {* Andes NDS32.  *}
 .#define bfd_mach_n1           1
 .#define bfd_mach_n1h          2
@@ -336,14 +349,12 @@ DESCRIPTION
 .#define bfd_mach_n1h_v3       4
 .#define bfd_mach_n1h_v3m      5
 .  bfd_arch_ns32k,     {* National Semiconductors ns32000.  *}
-.  bfd_arch_w65,       {* WDC 65816.  *}
 .  bfd_arch_tic30,     {* Texas Instruments TMS320C30.  *}
 .  bfd_arch_tic4x,     {* Texas Instruments TMS320C3X/4X.  *}
 .#define bfd_mach_tic3x                30
 .#define bfd_mach_tic4x                40
 .  bfd_arch_tic54x,    {* Texas Instruments TMS320C54X.  *}
 .  bfd_arch_tic6x,     {* Texas Instruments TMS320C6X.  *}
-.  bfd_arch_tic80,     {* TI TMS320c80 (MVP).  *}
 .  bfd_arch_v850,      {* NEC V850.  *}
 .  bfd_arch_v850_rh850,{* NEC V850 (using RH850 ABI).  *}
 .#define bfd_mach_v850         1
@@ -403,6 +414,8 @@ DESCRIPTION
 . bfd_arch_iq2000,     {* Vitesse IQ2000.  *}
 .#define bfd_mach_iq2000       1
 .#define bfd_mach_iq10         2
+.  bfd_arch_bpf,       {* Linux eBPF.  *}
+.#define bfd_mach_bpf          1
 .  bfd_arch_epiphany,  {* Adapteva EPIPHANY.  *}
 .#define bfd_mach_epiphany16   1
 .#define bfd_mach_epiphany32   2
@@ -434,8 +447,6 @@ DESCRIPTION
 .#define bfd_mach_bfin         1
 .  bfd_arch_cr16,      {* National Semiconductor CompactRISC (ie CR16).  *}
 .#define bfd_mach_cr16         1
-.  bfd_arch_cr16c,     {* National Semiconductor CompactRISC.  *}
-.#define bfd_mach_cr16c                1
 .  bfd_arch_crx,       {*  National Semiconductor CRX.  *}
 .#define bfd_mach_crx          1
 .  bfd_arch_cris,      {* Axis CRIS.  *}
@@ -449,6 +460,8 @@ DESCRIPTION
 .#define bfd_mach_rl78         0x75
 .  bfd_arch_rx,               {* Renesas RX.  *}
 .#define bfd_mach_rx           0x75
+.#define bfd_mach_rx_v2                0x76
+.#define bfd_mach_rx_v3                0x77
 .  bfd_arch_s390,      {* IBM s390.  *}
 .#define bfd_mach_s390_31      31
 .#define bfd_mach_s390_64      64
@@ -517,6 +530,18 @@ DESCRIPTION
 .#define bfd_mach_wasm32       1
 .  bfd_arch_pru,       {* PRU.  *}
 .#define bfd_mach_pru          0
+.  bfd_arch_nfp,       {* Netronome Flow Processor *}
+.#define bfd_mach_nfp3200      0x3200
+.#define bfd_mach_nfp6000      0x6000
+.  bfd_arch_csky,      {* C-SKY.  *}
+.#define bfd_mach_ck_unknown    0
+.#define bfd_mach_ck510                1
+.#define bfd_mach_ck610                2
+.#define bfd_mach_ck801                3
+.#define bfd_mach_ck802                4
+.#define bfd_mach_ck803                5
+.#define bfd_mach_ck807                6
+.#define bfd_mach_ck810                7
 .  bfd_arch_last
 .  };
 */
@@ -556,6 +581,16 @@ DESCRIPTION
 .                bfd_boolean code);
 .
 .  const struct bfd_arch_info *next;
+.
+.  {* On some architectures the offset for a relocation can point into
+.     the middle of an instruction.  This field specifies the maximum
+.     offset such a relocation can have (in octets).  This affects the
+.     behaviour of the disassembler, since a value greater than zero
+.     means that it may need to disassemble an instruction twice, once
+.     to get its length and then a second time to display it.  If the
+.     value is negative then this has to be done for every single
+.     instruction, regardless of the offset of the reloc.  *}
+.  signed int max_reloc_offset_into_insn;
 .}
 .bfd_arch_info_type;
 .
@@ -568,19 +603,18 @@ extern const bfd_arch_info_type bfd_arm_arch;
 extern const bfd_arch_info_type bfd_avr_arch;
 extern const bfd_arch_info_type bfd_bfin_arch;
 extern const bfd_arch_info_type bfd_cr16_arch;
-extern const bfd_arch_info_type bfd_cr16c_arch;
 extern const bfd_arch_info_type bfd_cris_arch;
 extern const bfd_arch_info_type bfd_crx_arch;
+extern const bfd_arch_info_type bfd_csky_arch;
 extern const bfd_arch_info_type bfd_d10v_arch;
 extern const bfd_arch_info_type bfd_d30v_arch;
 extern const bfd_arch_info_type bfd_dlx_arch;
+extern const bfd_arch_info_type bfd_bpf_arch;
 extern const bfd_arch_info_type bfd_epiphany_arch;
 extern const bfd_arch_info_type bfd_fr30_arch;
 extern const bfd_arch_info_type bfd_frv_arch;
 extern const bfd_arch_info_type bfd_h8300_arch;
-extern const bfd_arch_info_type bfd_h8500_arch;
 extern const bfd_arch_info_type bfd_hppa_arch;
-extern const bfd_arch_info_type bfd_i370_arch;
 extern const bfd_arch_info_type bfd_i386_arch;
 extern const bfd_arch_info_type bfd_iamcu_arch;
 extern const bfd_arch_info_type bfd_ia64_arch;
@@ -595,8 +629,8 @@ extern const bfd_arch_info_type bfd_m68hc11_arch;
 extern const bfd_arch_info_type bfd_m68hc12_arch;
 extern const bfd_arch_info_type bfd_m9s12x_arch;
 extern const bfd_arch_info_type bfd_m9s12xg_arch;
+extern const bfd_arch_info_type bfd_s12z_arch;
 extern const bfd_arch_info_type bfd_m68k_arch;
-extern const bfd_arch_info_type bfd_m88k_arch;
 extern const bfd_arch_info_type bfd_mcore_arch;
 extern const bfd_arch_info_type bfd_mep_arch;
 extern const bfd_arch_info_type bfd_metag_arch;
@@ -610,6 +644,7 @@ extern const bfd_arch_info_type bfd_ft32_arch;
 extern const bfd_arch_info_type bfd_msp430_arch;
 extern const bfd_arch_info_type bfd_mt_arch;
 extern const bfd_arch_info_type bfd_nds32_arch;
+extern const bfd_arch_info_type bfd_nfp_arch;
 extern const bfd_arch_info_type bfd_nios2_arch;
 extern const bfd_arch_info_type bfd_ns32k_arch;
 extern const bfd_arch_info_type bfd_or1k_arch;
@@ -632,7 +667,6 @@ extern const bfd_arch_info_type bfd_tic30_arch;
 extern const bfd_arch_info_type bfd_tic4x_arch;
 extern const bfd_arch_info_type bfd_tic54x_arch;
 extern const bfd_arch_info_type bfd_tic6x_arch;
-extern const bfd_arch_info_type bfd_tic80_arch;
 extern const bfd_arch_info_type bfd_tilegx_arch;
 extern const bfd_arch_info_type bfd_tilepro_arch;
 extern const bfd_arch_info_type bfd_v850_arch;
@@ -640,8 +674,6 @@ extern const bfd_arch_info_type bfd_v850_rh850_arch;
 extern const bfd_arch_info_type bfd_vax_arch;
 extern const bfd_arch_info_type bfd_visium_arch;
 extern const bfd_arch_info_type bfd_wasm32_arch;
-extern const bfd_arch_info_type bfd_w65_arch;
-extern const bfd_arch_info_type bfd_we32k_arch;
 extern const bfd_arch_info_type bfd_xstormy16_arch;
 extern const bfd_arch_info_type bfd_xtensa_arch;
 extern const bfd_arch_info_type bfd_xc16x_arch;
@@ -661,19 +693,18 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_avr_arch,
     &bfd_bfin_arch,
     &bfd_cr16_arch,
-    &bfd_cr16c_arch,
     &bfd_cris_arch,
     &bfd_crx_arch,
+    &bfd_csky_arch,
     &bfd_d10v_arch,
     &bfd_d30v_arch,
     &bfd_dlx_arch,
+    &bfd_bpf_arch,
     &bfd_epiphany_arch,
     &bfd_fr30_arch,
     &bfd_frv_arch,
     &bfd_h8300_arch,
-    &bfd_h8500_arch,
     &bfd_hppa_arch,
-    &bfd_i370_arch,
     &bfd_i386_arch,
     &bfd_iamcu_arch,
     &bfd_ia64_arch,
@@ -688,8 +719,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_m68hc12_arch,
     &bfd_m9s12x_arch,
     &bfd_m9s12xg_arch,
+    &bfd_s12z_arch,
     &bfd_m68k_arch,
-    &bfd_m88k_arch,
     &bfd_mcore_arch,
     &bfd_mep_arch,
     &bfd_metag_arch,
@@ -703,6 +734,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_msp430_arch,
     &bfd_mt_arch,
     &bfd_nds32_arch,
+    &bfd_nfp_arch,
     &bfd_nios2_arch,
     &bfd_ns32k_arch,
     &bfd_or1k_arch,
@@ -722,16 +754,13 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_tic4x_arch,
     &bfd_tic54x_arch,
     &bfd_tic6x_arch,
-    &bfd_tic80_arch,
     &bfd_tilegx_arch,
     &bfd_tilepro_arch,
     &bfd_v850_arch,
     &bfd_v850_rh850_arch,
     &bfd_vax_arch,
     &bfd_visium_arch,
-    &bfd_w65_arch,
     &bfd_wasm32_arch,
-    &bfd_we32k_arch,
     &bfd_xstormy16_arch,
     &bfd_xtensa_arch,
     &bfd_xc16x_arch,
@@ -877,12 +906,13 @@ bfd_arch_get_compatible (const bfd *abfd,
     /* Otherwise architecture-specific code has to decide.  */
     return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
 
-  /* We can allow an unknown architecture if accept_unknowns
-     is true, or if the target is the "binary" format, which
-     has an unknown architecture.  Since the binary format can
+  /* We can allow an unknown architecture if accept_unknowns is true,
+     if UBFD is an IR object, or if the target is the "binary" format,
+     which has an unknown architecture.  Since the binary format can
      only be set by explicit request from the user, it is safe
      to assume that they know what they are doing.  */
   if (accept_unknowns
+      || ubfd->plugin_format == bfd_plugin_yes
       || strcmp (bfd_get_target (ubfd), "binary") == 0)
     return kbfd->arch_info;
   return NULL;
@@ -902,12 +932,13 @@ DESCRIPTION
 .extern const bfd_arch_info_type bfd_default_arch_struct;
 */
 
-const bfd_arch_info_type bfd_default_arch_struct = {
+const bfd_arch_info_type bfd_default_arch_struct =
+{
   32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
   bfd_default_compatible,
   bfd_default_scan,
   bfd_arch_default_fill,
-  0,
+  0, 0
 };
 
 /*
@@ -961,7 +992,7 @@ FUNCTION
        bfd_get_arch
 
 SYNOPSIS
-       enum bfd_architecture bfd_get_arch (bfd *abfd);
+       enum bfd_architecture bfd_get_arch (const bfd *abfd);
 
 DESCRIPTION
        Return the enumerated type which describes the BFD @var{abfd}'s
@@ -969,7 +1000,7 @@ DESCRIPTION
 */
 
 enum bfd_architecture
-bfd_get_arch (bfd *abfd)
+bfd_get_arch (const bfd *abfd)
 {
   return abfd->arch_info->arch;
 }
@@ -979,7 +1010,7 @@ FUNCTION
        bfd_get_mach
 
 SYNOPSIS
-       unsigned long bfd_get_mach (bfd *abfd);
+       unsigned long bfd_get_mach (const bfd *abfd);
 
 DESCRIPTION
        Return the long type which describes the BFD @var{abfd}'s
@@ -987,7 +1018,7 @@ DESCRIPTION
 */
 
 unsigned long
-bfd_get_mach (bfd *abfd)
+bfd_get_mach (const bfd *abfd)
 {
   return abfd->arch_info->mach;
 }
@@ -997,7 +1028,7 @@ FUNCTION
        bfd_arch_bits_per_byte
 
 SYNOPSIS
-       unsigned int bfd_arch_bits_per_byte (bfd *abfd);
+       unsigned int bfd_arch_bits_per_byte (const bfd *abfd);
 
 DESCRIPTION
        Return the number of bits in one of the BFD @var{abfd}'s
@@ -1005,7 +1036,7 @@ DESCRIPTION
 */
 
 unsigned int
-bfd_arch_bits_per_byte (bfd *abfd)
+bfd_arch_bits_per_byte (const bfd *abfd)
 {
   return abfd->arch_info->bits_per_byte;
 }
@@ -1015,7 +1046,7 @@ FUNCTION
        bfd_arch_bits_per_address
 
 SYNOPSIS
-       unsigned int bfd_arch_bits_per_address (bfd *abfd);
+       unsigned int bfd_arch_bits_per_address (const bfd *abfd);
 
 DESCRIPTION
        Return the number of bits in one of the BFD @var{abfd}'s
@@ -1023,7 +1054,7 @@ DESCRIPTION
 */
 
 unsigned int
-bfd_arch_bits_per_address (bfd *abfd)
+bfd_arch_bits_per_address (const bfd *abfd)
 {
   return abfd->arch_info->bits_per_address;
 }
@@ -1168,19 +1199,6 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
 
   switch (number)
     {
-      /* FIXME: These are needed to parse IEEE objects.  */
-      /* The following seven case's are here only for compatibility with
-        older binutils (at least IEEE objects from binutils 2.9.1 require
-        them).  */
-    case bfd_mach_m68000:
-    case bfd_mach_m68010:
-    case bfd_mach_m68020:
-    case bfd_mach_m68030:
-    case bfd_mach_m68040:
-    case bfd_mach_m68060:
-    case bfd_mach_cpu32:
-      arch = bfd_arch_m68k;
-      break;
     case 68000:
       arch = bfd_arch_m68k;
       number = bfd_mach_m68000;
@@ -1230,10 +1248,6 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
       number = bfd_mach_mcf_isa_aplus_emac;
       break;
 
-    case 32000:
-      arch = bfd_arch_we32k;
-      break;
-
     case 3000:
       arch = bfd_arch_mips;
       number = bfd_mach_mips3000;
@@ -1362,7 +1376,8 @@ FUNCTION
        bfd_octets_per_byte
 
 SYNOPSIS
-       unsigned int bfd_octets_per_byte (bfd *abfd);
+       unsigned int bfd_octets_per_byte (const bfd *abfd,
+                                         const asection *sec);
 
 DESCRIPTION
        Return the number of octets (8-bit quantities) per target byte
@@ -1371,8 +1386,13 @@ DESCRIPTION
 */
 
 unsigned int
-bfd_octets_per_byte (bfd *abfd)
+bfd_octets_per_byte (const bfd *abfd, const asection *sec)
 {
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
+      && sec != NULL
+      && (sec->flags & SEC_ELF_OCTETS) != 0)
+    return 1;
+
   return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
                                        bfd_get_mach (abfd));
 }
This page took 0.02855 seconds and 4 git commands to generate.