diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2022-12-01 15:03:42 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2023-05-30 19:56:41 +0800 |
commit | 1b6fccd28db14fffe75ff6755307047ef932c81e (patch) | |
tree | 4bef3438cda5dd24a6c4f3f1c703e625758d543d /bfd/libbfd.h | |
parent | 57a930e3bfe4b2c7fd6463ed39311e1938513138 (diff) | |
download | fsf-binutils-gdb-1b6fccd28db14fffe75ff6755307047ef932c81e.zip fsf-binutils-gdb-1b6fccd28db14fffe75ff6755307047ef932c81e.tar.gz fsf-binutils-gdb-1b6fccd28db14fffe75ff6755307047ef932c81e.tar.bz2 |
LoongArch: bfd: Add support for linker relaxation.
Add relax support and related relocs in bfd.
bfd/ChangeLog:
* bfd-in2.h: Add relocs related to relax.
* elfnn-loongarch.c (struct loongarch_elf_link_hash_table): New integer
pointer (data_segment_phase) to monitor the data segment phase.
(loongarch_elf_check_relocs): Swap B21/B26 reloc sequence.
(loongarch_elf_adjust_dynamic_symbol): Fix code format.
(loongarch_reloc_rewrite_imm_insn): Fix function call.
(perform_relocation): Handle new relocs related to relax.
(RELOCATE_CALC_PC32_HI20): Fix code format.
(RELOCATE_CALC_PC64_HI32): Likewise.
(loongarch_elf_relocate_section): Handle new relocs related to relax.
(loongarch_relax_delete_bytes): New function.
(loongarch_relax_pcala_addi): Likewise.
(loongarch_relax_pcala_ld): Likewise.
(bfd_elfNN_loongarch_set_data_segment_info): Likewise.
(loongarch_relax_align): Likewise.
(loongarch_elf_relax_section): Likewise.
(bfd_elfNN_bfd_relax_section): New macro define.
* elfxx-loongarch.c (reloc_bits): New bfd point parameter.
(reloc_bits_b16): Likewise.
(reloc_bits_b21): Likewise.
(reloc_bits_b26): Likewise.
(loongarch_adjust_reloc_bitsfield): Likewise.
(reloc_bits_pcrel20_s2): New function.
(loongarch_elf_add_sub_reloc): Likewise.
(loongarch_elf_add_sub_reloc_uleb128): Likewise.
(loongarch_write_unsigned_leb128): New function.
* elfxx-loongarch.h (loongarch_adjust_reloc_bitsfield): New bfd point
parameter.
(bfd_elf32_loongarch_set_data_segment_info): New declare.
(bfd_elf64_loongarch_set_data_segment_info): Likewise.
(loongarch_write_unsigned_leb128): Likewise.
* libbfd.h: Add relocs related to relax.
* reloc.c: Add relocs related to relax.
Diffstat (limited to 'bfd/libbfd.h')
-rw-r--r-- | bfd/libbfd.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bfd/libbfd.h b/bfd/libbfd.h index f29a65a..4f082ac 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -3509,6 +3509,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_LARCH_TLS_GD_HI20", "BFD_RELOC_LARCH_32_PCREL", "BFD_RELOC_LARCH_RELAX", + "BFD_RELOC_LARCH_DELETE", + "BFD_RELOC_LARCH_ALIGN", + "BFD_RELOC_LARCH_PCREL20_S2", + "BFD_RELOC_LARCH_CFA", + "BFD_RELOC_LARCH_ADD6", + "BFD_RELOC_LARCH_SUB6", + "BFD_RELOC_LARCH_ADD_ULEB128", + "BFD_RELOC_LARCH_SUB_ULEB128", "@@overflow: BFD_RELOC_UNUSED@@", }; #endif |