Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / bfd / archures.c
index 02c8e4ec93e822746c728ec2dd413e65601064d8..aaab2eac5d99ea3d0b467366d6c6d274f44bbb77 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD library support routines for architectures.
-   Copyright (C) 1990-2019 Free Software Foundation, Inc.
+   Copyright (C) 1990-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -355,7 +356,6 @@ DESCRIPTION
 .#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
@@ -448,8 +448,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.  *}
@@ -508,9 +506,13 @@ DESCRIPTION
 .  bfd_arch_xtensa,    {* Tensilica's Xtensa cores.  *}
 .#define bfd_mach_xtensa       1
 .  bfd_arch_z80,
-.#define bfd_mach_z80strict    1 {* No undocumented opcodes.  *}
-.#define bfd_mach_z80          3 {* With ixl, ixh, iyl, and iyh.  *}
-.#define bfd_mach_z80full      7 {* All undocumented instructions.  *}
+.#define bfd_mach_gbz80         0 {* GameBoy Z80 (reduced instruction set) *}
+.#define bfd_mach_z80strict    1 {* Z80 without undocumented opcodes.  *}
+.#define bfd_mach_z180          2 {* Z180: successor with additional instructions, but without halves of ix and iy *}
+.#define bfd_mach_z80          3 {* Z80 with ixl, ixh, iyl, and iyh.  *}
+.#define bfd_mach_ez80_z80      4 {* eZ80 (successor of Z80 & Z180) in Z80 (16-bit address) mode *}
+.#define bfd_mach_ez80_adl      5 {* eZ80 (successor of Z80 & Z180) in ADL (24-bit address) mode *}
+.#define bfd_mach_z80full      7 {* Z80 with all undocumented instructions.  *}
 .#define bfd_mach_r800         11 {* R800: successor with multiplication.  *}
 .  bfd_arch_lm32,      {* Lattice Mico32.  *}
 .#define bfd_mach_lm32         1
@@ -545,6 +547,18 @@ DESCRIPTION
 .#define bfd_mach_ck803                5
 .#define bfd_mach_ck807                6
 .#define bfd_mach_ck810                7
+.  bfd_arch_amdgcn,     {* AMD GPU Architecture. Must match EF_AMDGPU_MACH_* *}
+.#define bfd_mach_amdgcn_unknown 0x000
+.#define bfd_mach_amdgcn_gfx801  0x028
+.#define bfd_mach_amdgcn_gfx802  0x029
+.#define bfd_mach_amdgcn_gfx803  0x02a
+.#define bfd_mach_amdgcn_gfx810  0x02b
+.#define bfd_mach_amdgcn_gfx900  0x02c
+.#define bfd_mach_amdgcn_gfx902  0x02d
+.#define bfd_mach_amdgcn_gfx904  0x02e
+.#define bfd_mach_amdgcn_gfx906  0x02f
+.#define bfd_mach_amdgcn_gfx908  0x030
+.#define bfd_mach_amdgcn_gfx909  0x031
 .  bfd_arch_last
 .  };
 */
@@ -601,12 +615,12 @@ DESCRIPTION
 
 extern const bfd_arch_info_type bfd_aarch64_arch;
 extern const bfd_arch_info_type bfd_alpha_arch;
+extern const bfd_arch_info_type bfd_amdgcn_arch;
 extern const bfd_arch_info_type bfd_arc_arch;
 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;
@@ -671,7 +685,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;
@@ -693,12 +706,12 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
 #else
     &bfd_aarch64_arch,
     &bfd_alpha_arch,
+    &bfd_amdgcn_arch,
     &bfd_arc_arch,
     &bfd_arm_arch,
     &bfd_avr_arch,
     &bfd_bfin_arch,
     &bfd_cr16_arch,
-    &bfd_cr16c_arch,
     &bfd_cris_arch,
     &bfd_crx_arch,
     &bfd_csky_arch,
@@ -760,7 +773,6 @@ 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,
@@ -999,7 +1011,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
@@ -1007,7 +1019,7 @@ DESCRIPTION
 */
 
 enum bfd_architecture
-bfd_get_arch (bfd *abfd)
+bfd_get_arch (const bfd *abfd)
 {
   return abfd->arch_info->arch;
 }
@@ -1017,7 +1029,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
@@ -1025,7 +1037,7 @@ DESCRIPTION
 */
 
 unsigned long
-bfd_get_mach (bfd *abfd)
+bfd_get_mach (const bfd *abfd)
 {
   return abfd->arch_info->mach;
 }
@@ -1035,7 +1047,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
@@ -1043,7 +1055,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;
 }
@@ -1053,7 +1065,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
@@ -1061,7 +1073,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;
 }
@@ -1383,7 +1395,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
@@ -1392,8 +1405,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.026016 seconds and 4 git commands to generate.