diff options
author | Andreas Schwab <schwab@suse.de> | 2023-08-03 17:22:42 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2023-12-05 13:20:27 +0100 |
commit | 1b183017aa2fbb73785dc24b4cff32daae942c9c (patch) | |
tree | a38cc647f52a6a83f7c496ef7c36cbe04892f579 /bfd/libpei.h | |
parent | alpha_ecoff_get_relocated_section_contents buffer overflow (diff) | |
download | binutils-gdb-1b183017aa2fbb73785dc24b4cff32daae942c9c.tar.gz binutils-gdb-1b183017aa2fbb73785dc24b4cff32daae942c9c.tar.bz2 binutils-gdb-1b183017aa2fbb73785dc24b4cff32daae942c9c.zip |
Add basic support for RISC-V 64-bit EFI objects
This adds a new PEI target pei-riscv64-little. Only objdump and objcopy
are supported.
bfd:
* .gitignore: Add pe-riscv64igen.c.
* Makefile.am (BFD64_BACKENDS): Add pei-riscv64.lo,
pe-riscv64igen.lo.
(BFD64_BACKENDS_CFILES): Add pei-riscv64.c.
(BUILD_CFILES): Add pe-riscv64igen.c.
(pe-riscv64igen.c): New rule.
* Makefile.in: Regenerate.
* bfd.c (bfd_get_sign_extend_vma): Add pei-riscv64-little.
* coff-riscv64.c: New file.
* coffcode.h (coff_set_arch_mach_hook, coff_set_flags)
(coff_write_object_contents): Add riscv64 (riscv64_pei_vec)
support.
* config.bfd (targ_selvecs): Add riscv64_pei_vec to all riscv*
targets.
* configure.ac: Handle riscv64_pei_vec.
* configure: Regenerate.
* libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE)
(GET_OPTHDR_SIZE_OF_STACK_RESERVE)
(PUT_OPTHDR_SIZE_OF_STACK_RESERVE)
(GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT)
(GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE)
(GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT)
(GET_PDATA_ENTRY, _bfd_XX_bfd_copy_private_bfd_data_common)
(_bfd_XX_bfd_copy_private_section_data)
(_bfd_XX_get_symbol_info, _bfd_XX_only_swap_filehdr_out)
(_bfd_XX_print_private_bfd_data_common)
(_bfd_XXi_final_link_postscript, _bfd_XXi_only_swap_filehdr_out)
(_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out)
(_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out)
(_bfd_XXi_swap_lineno_in, _bfd_XXi_swap_lineno_out)
(_bfd_XXi_swap_scnhdr_out, _bfd_XXi_swap_sym_in)
(_bfd_XXi_swap_sym_out, _bfd_XXi_swap_debugdir_in)
(_bfd_XXi_swap_debugdir_out, _bfd_XXi_write_codeview_record)
(_bfd_XXi_slurp_codeview_record) [COFF_WITH_peRiscV64]: Define.
(_bfd_peRiscV64_print_ce_compressed_pdata): Declare.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out)
(_bfd_XXi_swap_scnhdr_out, pe_print_pdata)
(_bfd_XX_print_private_bfd_data_common)
(_bfd_XX_bfd_copy_private_section_data)
(_bfd_XXi_final_link_postscript): Support COFF_WITH_peRiscV64.
* pei-riscv64.c: New file.
* peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd)
(pe_ILF_object_p): Support COFF_WITH_peRiscV64.
(jtab): Add dummy entry that traps.
* targets.c (_bfd_target_vector): Add riscv64_pei_vec.
binutils:
* testsuite/binutils-all/riscv/pei-riscv64.d: New.
* testsuite/binutils-all/riscv/pei-riscv64.s: New.
include:
* coff/riscv64.h: New file.
* coff/pe.h (IMAGE_FILE_MACHINE_RISCV32)
(IMAGE_FILE_MACHINE_RISCV64): Define.
Diffstat (limited to 'bfd/libpei.h')
-rw-r--r-- | bfd/libpei.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bfd/libpei.h b/bfd/libpei.h index 9837d4628dd..e8f2931dd96 100644 --- a/bfd/libpei.h +++ b/bfd/libpei.h @@ -347,6 +347,41 @@ #define _bfd_XXi_write_codeview_record _bfd_peLoongArch64i_write_codeview_record #define _bfd_XXi_slurp_codeview_record _bfd_peLoongArch64i_slurp_codeview_record +#elif defined COFF_WITH_peRiscV64 + +#define GET_OPTHDR_IMAGE_BASE H_GET_64 +#define PUT_OPTHDR_IMAGE_BASE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64 +#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64 +#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64 +#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64 +#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64 +#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64 +#define GET_PDATA_ENTRY bfd_get_32 + +#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_peRiscV64_bfd_copy_private_bfd_data_common +#define _bfd_XX_bfd_copy_private_section_data _bfd_peRiscV64_bfd_copy_private_section_data +#define _bfd_XX_get_symbol_info _bfd_peRiscV64_get_symbol_info +#define _bfd_XX_only_swap_filehdr_out _bfd_peRiscV64_only_swap_filehdr_out +#define _bfd_XX_print_private_bfd_data_common _bfd_peRiscV64_print_private_bfd_data_common +#define _bfd_XXi_final_link_postscript _bfd_peRiscV64i_final_link_postscript +#define _bfd_XXi_only_swap_filehdr_out _bfd_peRiscV64i_only_swap_filehdr_out +#define _bfd_XXi_swap_aouthdr_in _bfd_peRiscV64i_swap_aouthdr_in +#define _bfd_XXi_swap_aouthdr_out _bfd_peRiscV64i_swap_aouthdr_out +#define _bfd_XXi_swap_aux_in _bfd_peRiscV64i_swap_aux_in +#define _bfd_XXi_swap_aux_out _bfd_peRiscV64i_swap_aux_out +#define _bfd_XXi_swap_lineno_in _bfd_peRiscV64i_swap_lineno_in +#define _bfd_XXi_swap_lineno_out _bfd_peRiscV64i_swap_lineno_out +#define _bfd_XXi_swap_scnhdr_out _bfd_peRiscV64i_swap_scnhdr_out +#define _bfd_XXi_swap_sym_in _bfd_peRiscV64i_swap_sym_in +#define _bfd_XXi_swap_sym_out _bfd_peRiscV64i_swap_sym_out +#define _bfd_XXi_swap_debugdir_in _bfd_peRiscV64i_swap_debugdir_in +#define _bfd_XXi_swap_debugdir_out _bfd_peRiscV64i_swap_debugdir_out +#define _bfd_XXi_write_codeview_record _bfd_peRiscV64i_write_codeview_record +#define _bfd_XXi_slurp_codeview_record _bfd_peRiscV64i_slurp_codeview_record + #else /* !COFF_WITH_pep */ #define GET_OPTHDR_IMAGE_BASE H_GET_32 @@ -445,6 +480,7 @@ bool _bfd_pe64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_pex64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_peAArch64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_peLoongArch64_print_ce_compressed_pdata (bfd *, void *); +bool _bfd_peRiscV64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_pep_print_ce_compressed_pdata (bfd *, void *); #endif /* _LIBPEI_H */ |