binutils-gdb/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
mengqinggang be1ebb6710 LoongArch: Add R_LARCH_64_PCREL relocation support
Gas defaults to emit R_LARCH_ADD64/R_LARCH_SUB64 unless explcitly declared
  to emit R_LARCH_64_PCREL.

  The LoongArch ABI at here:
    https://github.com/loongson/la-abi-specs/blob/release/la-abi.adoc

bfd/ChangeLog:

	* bfd-in2.h (not): Add R_LARCH_64_PCREL
	* elfnn-loongarch.c (perform_relocation): Likewise.
	* elfxx-loongarch.c: Likewise.
	* libbfd.h: Likewise.
	* reloc.c: Likewise.

gas/ChangeLog:

	* config/tc-loongarch.c (loongarch_args_parser_can_match_arg_helper):
	(md_apply_fix): Add R_LARCH_64_PCREL.
	* testsuite/gas/loongarch/64_pcrel.d: New test.
	* testsuite/gas/loongarch/64_pcrel.s: New test.

include/ChangeLog:

	* elf/loongarch.h (RELOC_NUMBER): Add R_LARCH_64_PCREL.

ld/ChangeLog:

	* testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Add test.
	* testsuite/ld-loongarch-elf/64_pcrel.d: New test.
	* testsuite/ld-loongarch-elf/64_pcrel.s: New test.
2023-06-28 16:14:35 +08:00

59 lines
1.6 KiB
Plaintext

# Expect script for LoongArch ELF linker tests
# Copyright (C) 2021-2023 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
proc loongarch_choose_lp64_emul {} {
if { [istarget "loongarch64be-*"] } {
return "elf64bloongarch"
}
return "elf64lloongarch"
}
if [istarget "loongarch64-*-*"] {
run_dump_test "jmp_op"
run_dump_test "macro_op"
run_dump_test "syscall"
run_dump_test "disas-jirl"
run_dump_test "local-ifunc-reloc"
}
if [istarget "loongarch32-*-*"] {
run_dump_test "jmp_op"
run_dump_test "macro_op_32"
run_dump_test "syscall"
run_dump_test "disas-jirl-32"
}
if [istarget "loongarch64-*-*"] {
run_ld_link_tests \
[list \
[list \
"64_pcrel" \
"-e 0x0 -z relro" "" \
"" \
{64_pcrel.s} \
[list \
[list objdump -D 64_pcrel.d] \
] \
"64_pcrel" \
] \
]
}