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/reloc.c | |
parent | 77d242a06e352eee88908326d7bbf3b77086d5db (diff) | |
download | gdb-aae8784c58d693fa8bc0161b325fc8bcd76d18fc.zip gdb-aae8784c58d693fa8bc0161b325fc8bcd76d18fc.tar.gz 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/reloc.c')
-rw-r--r-- | bfd/reloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bfd/reloc.c b/bfd/reloc.c index 30852b1..3edcbab 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -8331,6 +8331,13 @@ ENUMX BFD_RELOC_LARCH_TLS_DESC_CALL ENUMX + BFD_RELOC_LARCH_TLS_LE_HI20_R +ENUMX + BFD_RELOC_LARCH_TLS_LE_ADD_R +ENUMX + BFD_RELOC_LARCH_TLS_LE_LO12_R + +ENUMX BFD_RELOC_LARCH_TLS_LD_PCREL20_S2 ENUMX BFD_RELOC_LARCH_TLS_GD_PCREL20_S2 |