BFD_RELOC_LARCH_SUB6,
BFD_RELOC_LARCH_ADD_ULEB128,
BFD_RELOC_LARCH_SUB_ULEB128,
+ BFD_RELOC_LARCH_64_PCREL,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
/* For eh_frame and debug info. */
case R_LARCH_32_PCREL:
+ case R_LARCH_64_PCREL:
{
value -= sec_addr (input_section) + rel->r_offset;
value += rel->r_addend;
NULL, /* adjust_reloc_bits. */
NULL), /* larch_reloc_type_name. */
+ /* 64-bit PC relative. */
+ LOONGARCH_HOWTO (R_LARCH_64_PCREL, /* type (109). */
+ 0, /* rightshift. */
+ 8, /* size. */
+ 64, /* bitsize. */
+ true, /* pc_relative. */
+ 0, /* bitpos. */
+ complain_overflow_signed, /* complain_on_overflow. */
+ bfd_elf_generic_reloc, /* special_function. */
+ "R_LARCH_64_PCREL", /* name. */
+ false, /* partial_inplace. */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ false, /* pcrel_offset */
+ BFD_RELOC_LARCH_64_PCREL, /* bfd_reloc_code_real_type */
+ NULL, /* adjust_reloc_bits */
+ NULL), /* larch_reloc_type_name */
+
};
reloc_howto_type *
"BFD_RELOC_LARCH_SUB6",
"BFD_RELOC_LARCH_ADD_ULEB128",
"BFD_RELOC_LARCH_SUB_ULEB128",
+ "BFD_RELOC_LARCH_64_PCREL",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
ENUMX
BFD_RELOC_LARCH_SUB_ULEB128
+ENUMX
+ BFD_RELOC_LARCH_64_PCREL
+
ENUMDOC
LARCH relocations.
esc_ch1, esc_ch2, bit_field, arg);
if (ip->reloc_info[0].type >= BFD_RELOC_LARCH_B16
- && ip->reloc_info[0].type < BFD_RELOC_LARCH_SUB_ULEB128)
+ && ip->reloc_info[0].type < BFD_RELOC_LARCH_64_PCREL)
{
/* As we compact stack-relocs, it is no need for pop operation.
But break out until here in order to check the imm field.
function. If only fx_addsy not null, we generate
BFD_RELOC_LARCH_ADD24/16/8 only, then generate R_LARCH_24/16/8.
To avoid R_LARCH_ADDxx add extra value, we write 0 first
- (use md_number_to_chars (buf, 0, fixP->fx_size)).
- */
+ (use md_number_to_chars (buf, 0, fixP->fx_size)). */
case BFD_RELOC_64:
case BFD_RELOC_32:
if (fixP->fx_r_type == BFD_RELOC_32
--- /dev/null
+#as:
+#objdump: -dr
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+00000000.* <.text>:
+[ ]+0:[ ]+03400000[ ]+andi[ ]+\$zero,[ ]+\$zero,[ ]+0x0
+[ ]+0:[ ]+R_LARCH_64_PCREL[ ]+\*ABS\*
--- /dev/null
+nop
+.reloc 0, R_LARCH_64_PCREL, 0
RELOC_NUMBER (R_LARCH_ADD_ULEB128, 107)
RELOC_NUMBER (R_LARCH_SUB_ULEB128, 108)
+RELOC_NUMBER (R_LARCH_64_PCREL, 109)
+
END_RELOC_NUMBERS (R_LARCH_count)
/* Processor specific flags for the ELF header e_flags field. */
--- /dev/null
+#...
+.*0xffffbffc.*
+.*0xffffffff.*
+#pass
--- /dev/null
+.text
+ nop
+ nop
+L1:
+ nop
+.data
+ nop
+ nop
+ .8byte 0x1234567812345678
+ .reloc 0,R_LARCH_64_PCREL,L1
+ nop
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" \
+ ] \
+ ]
+}