diff options
author | changjiachen <changjiachen@stu.xupt.edu.cn> | 2023-12-28 20:07:54 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2023-12-29 15:11:00 +0800 |
commit | aae8784c58d693fa8bc0161b325fc8bcd76d18fc (patch) | |
tree | 8f9e162e56d200840a1e04f5e5b22a547f98712e /bfd/libbfd.h | |
parent | 77d242a06e352eee88908326d7bbf3b77086d5db (diff) | |
download | fsf-binutils-gdb-aae8784c58d693fa8bc0161b325fc8bcd76d18fc.zip fsf-binutils-gdb-aae8784c58d693fa8bc0161b325fc8bcd76d18fc.tar.gz fsf-binutils-gdb-aae8784c58d693fa8bc0161b325fc8bcd76d18fc.tar.bz2 |
LoongArch: bfd: Add support for tls le relax.
Add tls le relax support and related relocs in bfd.
New relocation related explanation can refer to the following url:
https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc
This support does two main things:
1. Implement support for three new relocation items in bfd.
The three new relocation items are shown below:
R_LARCH_TLS_LE_ADD_R
R_LARCH_TLS_LE_HI20_R
R_LARCH_TLS_LE_LO12_R
2. ADD a new macro RELOCATE_TLS_TP32_HI20
Handle problems caused by symbol extensions in TLS LE, The processing
is similar to the macro RELOCATE_CALC_PC32_HI20 method.
3. Implement the tls le relax function.
bfd/ChangeLog:
* bfd-in2.h: Add relocs related to tls le relax.
* elfnn-loongarch.c:
(loongarch_relax_tls_le): New function.
(RELOCATE_TLS_TP32_HI20): New macro.
(loongarch_elf_check_relocs): Add new reloc support.
(perform_relocation): Likewise.
(loongarch_elf_relocate_section): Handle new relocs related to relax.
(loongarch_elf_relax_section): Likewise.
* elfxx-loongarch.c:
(LOONGARCH_HOWTO (R_LARCH_TLS_LE_ADD_R)): New reloc how to type.
(LOONGARCH_HOWTO (R_LARCH_TLS_LE_HI20_R)): Likewise.
(LOONGARCH_HOWTO (R_LARCH_TLS_LE_LO12_R)): Likewise.
* libbfd.h: Add relocs related to tls le relax.
* reloc.c: Likewise.
Diffstat (limited to 'bfd/libbfd.h')
-rw-r--r-- | bfd/libbfd.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 196e7e5..a52fabd 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -3615,6 +3615,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_LARCH_TLS_DESC64_HI12", "BFD_RELOC_LARCH_TLS_DESC_LD", "BFD_RELOC_LARCH_TLS_DESC_CALL", + "BFD_RELOC_LARCH_TLS_LE_HI20_R", + "BFD_RELOC_LARCH_TLS_LE_ADD_R", + "BFD_RELOC_LARCH_TLS_LE_LO12_R", "BFD_RELOC_LARCH_TLS_LD_PCREL20_S2", "BFD_RELOC_LARCH_TLS_GD_PCREL20_S2", "BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2", |