]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: bfd: Add support for tls le relax.
authorchangjiachen <changjiachen@stu.xupt.edu.cn>
Thu, 28 Dec 2023 12:07:54 +0000 (20:07 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Fri, 29 Dec 2023 07:11:00 +0000 (15:11 +0800)
commitaae8784c58d693fa8bc0161b325fc8bcd76d18fc
tree8f9e162e56d200840a1e04f5e5b22a547f98712e
parent77d242a06e352eee88908326d7bbf3b77086d5db
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.
bfd/.elfnn-loongarch.c.swp [new file with mode: 0644]
bfd/bfd-in2.h
bfd/elfnn-loongarch.c
bfd/elfxx-loongarch.c
bfd/libbfd.h
bfd/reloc.c