1 1.1 christos /* BFD back-end for RISC-V 64-bit PE IMAGE COFF files. 2 1.1 christos Copyright (C) 2023-2024 Free Software Foundation, Inc. 3 1.1 christos 4 1.1 christos This file is part of BFD, the Binary File Descriptor library. 5 1.1 christos 6 1.1 christos This program is free software; you can redistribute it and/or modify 7 1.1 christos it under the terms of the GNU General Public License as published by 8 1.1 christos the Free Software Foundation; either version 3 of the License, or 9 1.1 christos (at your option) any later version. 10 1.1 christos 11 1.1 christos This program is distributed in the hope that it will be useful, 12 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 13 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 1.1 christos GNU General Public License for more details. 15 1.1 christos 16 1.1 christos You should have received a copy of the GNU General Public License 17 1.1 christos along with this program; if not, write to the Free Software 18 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 19 1.1 christos MA 02110-1301, USA. */ 20 1.1 christos 21 1.1 christos #include "sysdep.h" 22 1.1 christos #include "bfd.h" 23 1.1 christos 24 1.1 christos #define TARGET_SYM riscv64_pei_vec 25 1.1 christos #define TARGET_NAME "pei-riscv64-little" 26 1.1 christos #define TARGET_ARCHITECTURE bfd_arch_riscv 27 1.1 christos #define TARGET_PAGESIZE 0x4000 28 1.1 christos #define TARGET_BIG_ENDIAN 0 29 1.1 christos #define TARGET_ARCHIVE 0 30 1.1 christos #define TARGET_PRIORITY 0 31 1.1 christos 32 1.1 christos #define COFF_IMAGE_WITH_PE 33 1.1 christos /* Rename the above into... */ 34 1.1 christos #define COFF_WITH_peRiscV64 35 1.1 christos #define COFF_WITH_PE 36 1.1 christos #define PCRELOFFSET true 37 1.1 christos 38 1.1 christos /* Long section names not allowed in executable images, only object files. */ 39 1.1 christos #define COFF_LONG_SECTION_NAMES 0 40 1.1 christos 41 1.1 christos #define COFF_SECTION_ALIGNMENT_ENTRIES \ 42 1.1 christos { COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ 43 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ 44 1.1 christos { COFF_SECTION_NAME_EXACT_MATCH (".data"), \ 45 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ 46 1.1 christos { COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ 47 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ 48 1.1 christos { COFF_SECTION_NAME_EXACT_MATCH (".text"), \ 49 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ 50 1.1 christos { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ 51 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ 52 1.1 christos { COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ 53 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ 54 1.1 christos { COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ 55 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ 56 1.1 christos { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ 57 1.1 christos COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } 58 1.1 christos 59 1.1 christos #include "sysdep.h" 60 1.1 christos #include "bfd.h" 61 1.1 christos #include "libbfd.h" 62 1.1 christos #include "coff/riscv64.h" 63 1.1 christos #include "coff/internal.h" 64 1.1 christos #include "coff/pe.h" 65 1.1 christos #include "libcoff.h" 66 1.1 christos #include "libpei.h" 67 1.1 christos #include "libiberty.h" 68 1.1 christos 69 1.1 christos /* Make sure we're setting a 64-bit format. */ 70 1.1 christos #undef AOUTSZ 71 1.1 christos #define AOUTSZ PEPAOUTSZ 72 1.1 christos #define PEAOUTHDR PEPAOUTHDR 73 1.1 christos 74 1.1 christos #include "coff-riscv64.c" 75