From 9a02fbd1984021c1db08cfd855df0660745a0858 Mon Sep 17 00:00:00 2001 From: Mark Harmstone Date: Mon, 23 Jan 2023 23:01:54 +0000 Subject: ld: Add pdb support to aarch64-w64-mingw32 This extends PDB support to the aarch64 PE targets. The changes to the test files are just to make it so they can be assembled as either x86, x86_64, or aarch64, mainly by changing the comment style. The only actual code change here is in adding the architecture constants to pdb.c. --- ld/pdb.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'ld/pdb.c') diff --git a/ld/pdb.c b/ld/pdb.c index dade888..12c4ac4 100644 --- a/ld/pdb.c +++ b/ld/pdb.c @@ -591,13 +591,20 @@ populate_type_stream (bfd *pdb, bfd *stream, struct types *types) static uint16_t get_arch_number (bfd *abfd) { - if (abfd->arch_info->arch != bfd_arch_i386) - return 0; + switch (abfd->arch_info->arch) + { + case bfd_arch_i386: + if (abfd->arch_info->mach & bfd_mach_x86_64) + return IMAGE_FILE_MACHINE_AMD64; + else + return IMAGE_FILE_MACHINE_I386; - if (abfd->arch_info->mach & bfd_mach_x86_64) - return IMAGE_FILE_MACHINE_AMD64; + case bfd_arch_aarch64: + return IMAGE_FILE_MACHINE_ARM64; - return IMAGE_FILE_MACHINE_I386; + default: + return 0; + } } /* Validate the DEBUG_S_FILECHKSMS entry within a module's .debug$S @@ -3618,13 +3625,20 @@ handle_debugt_section (asection *s, bfd *mod, struct types *types, static uint16_t target_processor (bfd *abfd) { - if (abfd->arch_info->arch != bfd_arch_i386) - return 0; + switch (abfd->arch_info->arch) + { + case bfd_arch_i386: + if (abfd->arch_info->mach & bfd_mach_x86_64) + return CV_CFL_X64; + else + return CV_CFL_80386; - if (abfd->arch_info->mach & bfd_mach_x86_64) - return CV_CFL_X64; - else - return CV_CFL_80386; + case bfd_arch_aarch64: + return CV_CFL_ARM64; + + default: + return 0; + } } /* Create the symbols that go in "* Linker *", the dummy module created -- cgit v1.1