diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/Makefile.am | 2 | ||||
-rw-r--r-- | bfd/Makefile.in | 1 | ||||
-rw-r--r-- | bfd/archures.c | 1 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 1 | ||||
-rw-r--r-- | bfd/bfd.c | 1 | ||||
-rw-r--r-- | bfd/coff-aarch64.c | 168 | ||||
-rw-r--r-- | bfd/config.bfd | 16 | ||||
-rwxr-xr-x | bfd/configure | 3 | ||||
-rw-r--r-- | bfd/configure.ac | 3 | ||||
-rw-r--r-- | bfd/cpu-aarch64.c | 35 | ||||
-rw-r--r-- | bfd/pe-aarch64.c | 74 | ||||
-rw-r--r-- | bfd/pei-aarch64.c | 2 | ||||
-rw-r--r-- | bfd/peicode.h | 2 | ||||
-rw-r--r-- | bfd/po/SRC-POTFILES.in | 1 | ||||
-rw-r--r-- | bfd/targets.c | 6 |
15 files changed, 272 insertions, 44 deletions
diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 794d992..b70d8f3 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -578,6 +578,7 @@ BFD64_BACKENDS = \ pe-loongarch64igen.lo \ pe-x86_64.lo \ pei-aarch64.lo \ + pe-aarch64.lo \ pei-ia64.lo \ pei-loongarch64.lo \ pei-x86_64.lo \ @@ -619,6 +620,7 @@ BFD64_BACKENDS_CFILES = \ mach-o-aarch64.c \ mach-o-x86-64.c \ mmo.c \ + pe-aarch64.c \ pe-x86_64.c \ pei-aarch64.c \ pei-ia64.c \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index bdf12c9..3f52035 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1089,6 +1089,7 @@ BFD64_BACKENDS_CFILES = \ mach-o-aarch64.c \ mach-o-x86-64.c \ mmo.c \ + pe-aarch64.c \ pe-x86_64.c \ pei-aarch64.c \ pei-ia64.c \ diff --git a/bfd/archures.c b/bfd/archures.c index c67bacd..e817bb0 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -523,6 +523,7 @@ DESCRIPTION .#define bfd_mach_aarch64 0 .#define bfd_mach_aarch64_8R 1 .#define bfd_mach_aarch64_ilp32 32 +.#define bfd_mach_aarch64_llp64 64 . bfd_arch_nios2, {* Nios II. *} .#define bfd_mach_nios2 0 .#define bfd_mach_nios2r1 1 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 534a464..e09259b 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1857,6 +1857,7 @@ enum bfd_architecture #define bfd_mach_aarch64 0 #define bfd_mach_aarch64_8R 1 #define bfd_mach_aarch64_ilp32 32 +#define bfd_mach_aarch64_llp64 64 bfd_arch_nios2, /* Nios II. */ #define bfd_mach_nios2 0 #define bfd_mach_nios2r1 1 @@ -1743,6 +1743,7 @@ bfd_get_sign_extend_vma (bfd *abfd) || strcmp (name, "pei-i386") == 0 || strcmp (name, "pe-x86-64") == 0 || strcmp (name, "pei-x86-64") == 0 + || strcmp (name, "pe-aarch64-little") == 0 || strcmp (name, "pei-aarch64-little") == 0 || strcmp (name, "pe-arm-wince-little") == 0 || strcmp (name, "pei-arm-wince-little") == 0 diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c index e6f2fc2..2c3e225 100644 --- a/bfd/coff-aarch64.c +++ b/bfd/coff-aarch64.c @@ -39,34 +39,150 @@ #include "libcoff.h" -/* The page size is a guess based on ELF. */ +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ +#define MINUS_ONE (~ (bfd_vma) 0) + +static const reloc_howto_type arm64_reloc_howto_64 = HOWTO(IMAGE_REL_ARM64_ADDR64, 0, 8, 64, false, 0, + complain_overflow_bitfield, + NULL, "64", + false, MINUS_ONE, MINUS_ONE, false); + +static const reloc_howto_type arm64_reloc_howto_32 = HOWTO (IMAGE_REL_ARM64_ADDR32, 0, 4, 32, false, 0, + complain_overflow_bitfield, + NULL, "32", + false, 0xffffffff, 0xffffffff, false); + +static const reloc_howto_type arm64_reloc_howto_32_pcrel = HOWTO (IMAGE_REL_ARM64_REL32, 0, 4, 32, true, 0, + complain_overflow_bitfield, + NULL, "DISP32", + false, 0xffffffff, 0xffffffff, true); + +static const reloc_howto_type arm64_reloc_howto_branch26 = HOWTO (IMAGE_REL_ARM64_BRANCH26, 0, 4, 26, true, 0, + complain_overflow_bitfield, + NULL, "BRANCH26", + false, 0x03ffffff, 0x03ffffff, true); + +static const reloc_howto_type arm64_reloc_howto_page21 = HOWTO (IMAGE_REL_ARM64_PAGEBASE_REL21, 12, 4, 21, true, 0, + complain_overflow_signed, + NULL, "PAGE21", + false, 0x1fffff, 0x1fffff, false); + +static const reloc_howto_type arm64_reloc_howto_lo21 = HOWTO (IMAGE_REL_ARM64_REL21, 0, 4, 21, true, 0, + complain_overflow_signed, + NULL, "LO21", + false, 0x1fffff, 0x1fffff, true); + +static const reloc_howto_type arm64_reloc_howto_pgoff12 = HOWTO (IMAGE_REL_ARM64_PAGEOFFSET_12L, 1, 4, 12, true, 0, + complain_overflow_signed, + NULL, "PGOFF12", + false, 0xffe, 0xffe, true); + +static const reloc_howto_type arm64_reloc_howto_branch19 = HOWTO (IMAGE_REL_ARM64_BRANCH19, 2, 4, 19, true, 0, + complain_overflow_signed, + NULL, "BRANCH19", + false, 0x7ffff, 0x7ffff, true); + + +static const reloc_howto_type* const arm64_howto_table[] = { + &arm64_reloc_howto_64, + &arm64_reloc_howto_32, + &arm64_reloc_howto_32_pcrel, + &arm64_reloc_howto_branch26, + &arm64_reloc_howto_page21, + &arm64_reloc_howto_lo21, + &arm64_reloc_howto_pgoff12, + &arm64_reloc_howto_branch19 +}; -#define COFF_PAGE_SIZE 0x1000 +#ifndef NUM_ELEM +#define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0])) +#endif -/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */ -#define OCTETS_PER_BYTE(ABFD, SEC) 1 +#define NUM_RELOCS NUM_ELEM (arm64_howto_table) -#ifndef PCRELOFFSET -#define PCRELOFFSET true -#endif +#define coff_bfd_reloc_type_lookup coff_aarch64_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_aarch64_reloc_name_lookup -/* Currently we don't handle any relocations. */ -static reloc_howto_type pe_aarch64_std_reloc_howto[] = +static reloc_howto_type * +coff_aarch64_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) +{ + switch (code) { + case BFD_RELOC_64: + return &arm64_reloc_howto_64; + case BFD_RELOC_32: + return &arm64_reloc_howto_32; + case BFD_RELOC_32_PCREL: + return &arm64_reloc_howto_32_pcrel; + case BFD_RELOC_AARCH64_CALL26: + case BFD_RELOC_AARCH64_JUMP26: + return &arm64_reloc_howto_branch26; + case BFD_RELOC_AARCH64_ADR_HI21_PCREL: + return &arm64_reloc_howto_page21; + case BFD_RELOC_AARCH64_ADR_LO21_PCREL: + return &arm64_reloc_howto_lo21; + case BFD_RELOC_AARCH64_LDST16_LO12: + return &arm64_reloc_howto_pgoff12; + case BFD_RELOC_AARCH64_BRANCH19: + return &arm64_reloc_howto_branch19; + default: + BFD_FAIL (); + return NULL; + } + + return NULL; +} + +static reloc_howto_type * +coff_aarch64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; - }; + for (i = 0; i < NUM_RELOCS; i++) + if (arm64_howto_table[i]->name != NULL + && strcasecmp (arm64_howto_table[i]->name, r_name) == 0) + return arm64_howto_table[i]; + + return NULL; +} #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 #define COFF_PAGE_SIZE 0x1000 -#ifndef NUM_ELEM -#define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0])) -#endif +static reloc_howto_type * +coff_aarch64_rtype_lookup (unsigned int code) +{ + switch (code) + { + case IMAGE_REL_ARM64_ADDR64: + return &arm64_reloc_howto_64; + case IMAGE_REL_ARM64_ADDR32: + return &arm64_reloc_howto_32; + case IMAGE_REL_ARM64_REL32: + return &arm64_reloc_howto_32_pcrel; + case IMAGE_REL_ARM64_BRANCH26: + return &arm64_reloc_howto_branch26; + case IMAGE_REL_ARM64_PAGEBASE_REL21: + return &arm64_reloc_howto_page21; + case IMAGE_REL_ARM64_REL21: + return &arm64_reloc_howto_lo21; + case IMAGE_REL_ARM64_PAGEOFFSET_12L: + return &arm64_reloc_howto_pgoff12; + case IMAGE_REL_ARM64_BRANCH19: + return &arm64_reloc_howto_branch19; + default: + BFD_FAIL (); + return NULL; + } + + return NULL; +} -#define NUM_RELOCS NUM_ELEM (pe_aarch64_std_reloc_howto) +#define RTYPE2HOWTO(cache_ptr, dst) \ + ((cache_ptr)->howto = coff_aarch64_rtype_lookup((dst)->r_type)) -#define RTYPE2HOWTO(cache_ptr, dst) \ - (cache_ptr)->howto = NULL +#define SELECT_RELOC(x,howto) { (x).r_type = (howto)->type; } #ifndef bfd_pe_print_pdata #define bfd_pe_print_pdata NULL @@ -93,13 +209,13 @@ const bfd_target #ifdef TARGET_SYM TARGET_SYM = #else - aarch64_pei_vec = +# error "target symbol name not specified" #endif { #ifdef TARGET_NAME TARGET_NAME, #else - "pei-aarch64-little", /* Name. */ +# error "target name not specified" #endif bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ @@ -125,14 +241,14 @@ const bfd_target 0, /* match priority. */ TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */ - /* Data conversion functions. */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ - /* Header conversion functions. */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */ + /* Data conversion functions. */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ + /* Header conversion functions. */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */ /* Note that we allow an object file to be treated as a core file as well. */ { /* bfd_check_format. */ diff --git a/bfd/config.bfd b/bfd/config.bfd index 5eb82d7..0ae8eb3 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -245,9 +245,15 @@ case "${targ}" in ;; aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*) targ_defvec=aarch64_elf64_le_vec - targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec" + targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_le_vec aarch64_pe_le_vec" want64=true ;; + aarch64-*-pe*) + targ_defvec=aarch64_pe_le_vec + targ_selvecs="aarch64_pe_le_vec aarch64_pei_le_vec" + want64=true + targ_underscore=no + ;; aarch64_be-*-elf) targ_defvec=aarch64_elf64_be_vec targ_selvecs="aarch64_elf64_le_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_be_vec arm_elf32_le_vec" @@ -280,7 +286,7 @@ case "${targ}" in ;; aarch64-*-linux* | aarch64-*-netbsd*) targ_defvec=aarch64_elf64_le_vec - targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec" + targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_le_vec aarch64_pe_le_vec" want64=true ;; aarch64_be-*-linux* | aarch64_be-*-netbsd*) @@ -1488,6 +1494,12 @@ case "${targ}" in ;; esac +if test x"$targ_defvec" = x"aarch64-pe"; then + # Not currently complete (and probably not stable), warn user + echo "*** WARNING BFD aarch64-pe support not complete nor stable" + echo "*** Do not rely on this for production purposes" +fi + # All MIPS ELF targets need a 64-bit bfd_vma. case "${targ_defvec} ${targ_selvecs}" in *mips_elf*) diff --git a/bfd/configure b/bfd/configure index b72e885..bae9d17 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13603,7 +13603,8 @@ do aarch64_elf64_le_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; aarch64_elf64_le_cloudabi_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; aarch64_mach_o_vec) tb="$tb mach-o-aarch64.lo"; target_size=64 ;; - aarch64_pei_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;; + aarch64_pei_le_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;; + aarch64_pe_le_vec) tb="$tb pe-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;; alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;; alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; diff --git a/bfd/configure.ac b/bfd/configure.ac index 7a0ad0f..74c0f07 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -404,7 +404,8 @@ do aarch64_elf64_le_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; aarch64_elf64_le_cloudabi_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; aarch64_mach_o_vec) tb="$tb mach-o-aarch64.lo"; target_size=64 ;; - aarch64_pei_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;; + aarch64_pei_le_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;; + aarch64_pe_le_vec) tb="$tb pe-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;; alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;; alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; diff --git a/bfd/cpu-aarch64.c b/bfd/cpu-aarch64.c index e1bd8fc..eb88d0e 100644 --- a/bfd/cpu-aarch64.c +++ b/bfd/cpu-aarch64.c @@ -39,8 +39,8 @@ compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b) if (a->mach == b->mach) return a; - /* Don't allow mixing ilp32 with lp64. */ - if ((a->mach & bfd_mach_aarch64_ilp32) != (b->mach & bfd_mach_aarch64_ilp32)) + /* Don't allow mixing data models. */ + if ((a->mach ^ b->mach) & (bfd_mach_aarch64_ilp32 | bfd_mach_aarch64_llp64)) return NULL; /* Otherwise if either a or b is the 'default' machine @@ -102,20 +102,33 @@ scan (const struct bfd_arch_info *info, const char *string) return false; } -#define N(NUMBER, PRINT, WORDSIZE, DEFAULT, NEXT) \ - { WORDSIZE, WORDSIZE, 8, bfd_arch_aarch64, NUMBER, \ - "aarch64", PRINT, 4, DEFAULT, compatible, scan, \ - bfd_arch_default_fill, NEXT, 0 } +/* Figure out if llp64 is default */ +#if DEFAULT_VECTOR == aarch64_pe_le_vec +#define LLP64_DEFAULT true +#define AARCH64_DEFAULT false +#else +#define LLP64_DEFAULT false +#define AARCH64_DEFAULT true +#endif -static const bfd_arch_info_type bfd_aarch64_arch_v8_r = - N (bfd_mach_aarch64_8R, "aarch64:armv8-r", 64, false, NULL); +#define N(NUMBER, PRINT, WORDSIZE, ADDRSIZE, DEFAULT, NEXT) \ + { WORDSIZE, ADDRSIZE, 8, bfd_arch_aarch64, NUMBER, \ + "aarch64", PRINT, 4, DEFAULT, compatible, scan, \ + bfd_arch_default_fill, NEXT, 0 } + + static const bfd_arch_info_type bfd_aarch64_arch_v8_r = + N (bfd_mach_aarch64_8R, "aarch64:armv8-r", 64, 64, false, NULL); static const bfd_arch_info_type bfd_aarch64_arch_ilp32 = - N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", 32, false, + N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", 32, 32, false, &bfd_aarch64_arch_v8_r); -const bfd_arch_info_type bfd_aarch64_arch = - N (0, "aarch64", 64, true, &bfd_aarch64_arch_ilp32); +static const bfd_arch_info_type bfd_aarch64_arch_llp64 = + N (bfd_mach_aarch64_llp64, "aarch64:llp64", 32, 64, LLP64_DEFAULT, + &bfd_aarch64_arch_ilp32); + + const bfd_arch_info_type bfd_aarch64_arch = + N (0, "aarch64", 64, 64, AARCH64_DEFAULT, &bfd_aarch64_arch_llp64); bool bfd_is_aarch64_special_symbol_name (const char *name, int type) diff --git a/bfd/pe-aarch64.c b/bfd/pe-aarch64.c new file mode 100644 index 0000000..0790ba3 --- /dev/null +++ b/bfd/pe-aarch64.c @@ -0,0 +1,74 @@ +/* BFD back-end for AArch64 PE IMAGE COFF files. + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" + +#define TARGET_SYM aarch64_pe_le_vec +#define TARGET_NAME "pe-aarch64-little" +#define TARGET_ARCHITECTURE bfd_arch_aarch64 +#define TARGET_PAGESIZE 4096 +#define TARGET_BIG_ENDIAN 0 +#define TARGET_ARCHIVE 0 +#define TARGET_PRIORITY 0 + +/* Rename the above into.. */ +#define COFF_WITH_peAArch64 +#define COFF_WITH_PE +#define PCRELOFFSET true + +/* Long section names not allowed in executable images, only object files. */ +#define COFF_LONG_SECTION_NAMES 1 + +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } + +#define PEI_HEADERS +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" +#include "coff/aarch64.h" +#include "coff/internal.h" +#include "coff/pe.h" +#include "libcoff.h" +#include "libpei.h" +#include "libiberty.h" + +/* Make sure we're setting a 64-bit format. */ +#undef AOUTSZ +#define AOUTSZ PEPAOUTSZ +#define PEAOUTHDR PEPAOUTHDR + +#include "coff-aarch64.c" diff --git a/bfd/pei-aarch64.c b/bfd/pei-aarch64.c index c447690..7b6c681 100644 --- a/bfd/pei-aarch64.c +++ b/bfd/pei-aarch64.c @@ -21,7 +21,7 @@ #include "sysdep.h" #include "bfd.h" -#define TARGET_SYM aarch64_pei_vec +#define TARGET_SYM aarch64_pei_le_vec #define TARGET_NAME "pei-aarch64-little" #define TARGET_ARCHITECTURE bfd_arch_aarch64 #define TARGET_PAGESIZE 4096 diff --git a/bfd/peicode.h b/bfd/peicode.h index 3888dd4..add8d82 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -191,6 +191,8 @@ coff_swap_filehdr_in (bfd * abfd, void * src, void * dst) #ifdef COFF_IMAGE_WITH_PE # define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out +#elif defined COFF_WITH_peAArch64 +# define coff_swap_filehdr_out _bfd_XX_only_swap_filehdr_out #elif defined COFF_WITH_pex64 # define coff_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out #elif defined COFF_WITH_pep diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 30fce58..36e51fe 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -313,6 +313,7 @@ osf-core.c pc532-mach.c pdb.c pdp11.c +pe-aarch64.c pe-arm-wince.c pe-arm.c pe-i386.c diff --git a/bfd/targets.c b/bfd/targets.c index 7dbc3a5..0bb85b6 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -686,7 +686,8 @@ extern const bfd_target aarch64_elf64_be_cloudabi_vec; extern const bfd_target aarch64_elf64_le_vec; extern const bfd_target aarch64_elf64_le_cloudabi_vec; extern const bfd_target aarch64_mach_o_vec; -extern const bfd_target aarch64_pei_vec; +extern const bfd_target aarch64_pei_le_vec; +extern const bfd_target aarch64_pe_le_vec; extern const bfd_target alpha_ecoff_le_vec; extern const bfd_target alpha_elf64_vec; extern const bfd_target alpha_elf64_fbsd_vec; @@ -999,7 +1000,8 @@ static const bfd_target * const _bfd_target_vector[] = &aarch64_elf64_le_vec, &aarch64_elf64_le_cloudabi_vec, &aarch64_mach_o_vec, - &aarch64_pei_vec, + &aarch64_pe_le_vec, + &aarch64_pei_le_vec, #endif #ifdef BFD64 |