]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/elfnn-loongarch.c
LoongArch: Fix the issue of excessive relocation generated by GD and IE
authorLulu Cai <cailulu@loongson.cn>
Thu, 21 Mar 2024 08:33:21 +0000 (16:33 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Mon, 1 Apr 2024 09:41:56 +0000 (17:41 +0800)
commitb67a17aa7c0c478a2f2c2f045854e9745abfe114
tree6f63f30ff8aad6887c8c0860d44bebfefa0f55c2
parent7918b183ec7844b7d54a2164a177898e2db59f2e
LoongArch: Fix the issue of excessive relocation generated by GD and IE

Currently, whether GD and IE generate dynamic relocation is
determined by SYMBOL_REFERENCES_LOCAL and bfd_link_executable.
This results in dynamic relocations still being generated in some
situations where dynamic relocations are not necessary (such as
the undefined weak symbol in static links).

We use RLARCH_TLS_GD_IE_NEED_DYN_RELOC macros to determine whether
GD/IE needs dynamic relocation. If GD/IE requires dynamic relocation,
set need_reloc to true and indx to be a dynamic index.

At the same time, some test cases were modified to use regular
expression matching instead of complete disassembly matching.
bfd/elfnn-loongarch.c
ld/testsuite/ld-loongarch-elf/desc-ie.d
ld/testsuite/ld-loongarch-elf/tlsdesc-dso.d