]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: Force relocation for every reference to the global offset table
authorLulu Cai <cailulu@loongson.cn>
Thu, 17 Oct 2024 07:08:47 +0000 (15:08 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Tue, 22 Oct 2024 04:01:41 +0000 (12:01 +0800)
commit3790b9f7ff23857e44b58d4b710b1f014d956ef3
treec4b4e813964b80d64ed31f6f0d2b371f614bb109
parent4806ed93bc8de3b84d4380900e110c1b7fc7104f
LoongArch: Force relocation for every reference to the global offset table

Local absolute symbols are resolved at assembly stage and the symbol
value is placed in the relocation addend. But non-zero addend will
cause an assertion failure during linking.

Forces emission of relocations to defer resolution of local abs symbols
until link time.

bfd/

        * elfnn-loongarch.c (loongarch_elf_relax_section): Determine
          absolute symbols in advance to avoid ld crash.

gas/

        * config/tc-loongarch.c (loongarch_force_relocation): New
          function to force relocation.
        * config/tc-loongarch.h (TC_FORCE_RELOCATION): New macros
          to force relocation.
        (loongarch_force_relocation): Function declaration.
        * testsuite/gas/loongarch/localpic.d: New test.
        * testsuite/gas/loongarch/localpic.s: New test.
bfd/elfnn-loongarch.c
gas/config/tc-loongarch.c
gas/config/tc-loongarch.h
gas/testsuite/gas/loongarch/localpic.d [new file with mode: 0644]
gas/testsuite/gas/loongarch/localpic.s [new file with mode: 0644]