+2011-08-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/13082
+ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_RELATIVE64.
+ (elf_x86_64_relocate_section): Treat R_X86_64_64 like R_X86_64_32
+ and zero-extend it to 64bit if addend is zero for x32. Generate
+ R_X86_64_RELATIVE64 for x32.
+
2011-08-09 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
HOWTO(R_X86_64_IRELATIVE, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_X86_64_IRELATIVE", FALSE, MINUS_ONE,
MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_RELATIVE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_RELATIVE64", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
/* We have a gap in the reloc numbers here.
R_X86_64_standard counts the number up to this point, and
if (info->relocatable)
continue;
+ if (rel->r_addend == 0
+ && r_type == R_X86_64_64
+ && !ABI_64_P (output_bfd))
+ {
+ /* For x32, treat R_X86_64_64 like R_X86_64_32 and zero-extend
+ it to 64bit if addend is zero. */
+ r_type = R_X86_64_32;
+ memset (contents + rel->r_offset + 4, 0, 4);
+ }
+
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle
it here if it is defined in a non-shared object. */
if (h != NULL
outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
}
+ else if (r_type == R_X86_64_64
+ && !ABI_64_P (output_bfd))
+ {
+ relocate = TRUE;
+ outrel.r_info = htab->r_info (0,
+ R_X86_64_RELATIVE64);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
else
{
long sindx;
+2011-08-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/13082
+ * ld-x86-64/pr13082-1.s: New.
+ * ld-x86-64/pr13082-1a.d: Likewise.
+ * ld-x86-64/pr13082-1b.d: Likewise.
+ * ld-x86-64/pr13082-2.s: Likewise.
+ * ld-x86-64/pr13082-2a.d: Likewise.
+ * ld-x86-64/pr13082-2b.d: Likewise.
+ * ld-x86-64/pr13082-3.s: Likewise.
+ * ld-x86-64/pr13082-3a.d: Likewise.
+ * ld-x86-64/pr13082-3b.d: Likewise.
+ * ld-x86-64/pr13082-4.s: Likewise.
+ * ld-x86-64/pr13082-4a.d: Likewise.
+ * ld-x86-64/pr13082-4b.d: Likewise.
+ * ld-x86-64/pr13082-5.s: Likewise.
+ * ld-x86-64/pr13082-5a.d: Likewise.
+ * ld-x86-64/pr13082-5b.d: Likewise.
+ * ld-x86-64/pr13082-6.s: Likewise.
+ * ld-x86-64/pr13082-6a.d: Likewise.
+ * ld-x86-64/pr13082-6b.d: Likewise.
+
+ * ld-x86-64/x86-64.exp: Run pr13082-[1-6][ab].
+
2011-08-09 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ld-arm/arm-elf.exp (armelftests): Update for new command-line
--- /dev/null
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+.L1:
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad .L1
--- /dev/null
+#source: pr13082-1.s
+#name: PR ld/13082-1 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE64 +[0-9a-f]+
--- /dev/null
+#source: pr13082-1.s
+#name: PR ld/13082-1 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE64 +[0-9a-f]+
--- /dev/null
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad _start
--- /dev/null
+#source: pr13082-2.s
+#name: PR ld/13082-2 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +_start \+ 0
--- /dev/null
+#source: pr13082-2.s
+#name: PR ld/13082-2 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
--- /dev/null
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .weak func
+ .align 8
+.Ljmp:
+ .quad func
--- /dev/null
+#source: pr13082-3.s
+#name: PR ld/13082-3 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +func \+ 0
--- /dev/null
+#source: pr13082-3.s
+#name: PR ld/13082-3 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +func \+ 0
--- /dev/null
+ .text
+ .globl _start
+_start:
+ lea .Ljmp(%rip), %rax
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .weak func
+ .align 8
+.Ljmp:
+ .quad func + 1
--- /dev/null
+#source: pr13082-4.s
+#name: PR ld/13082-4 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +[0-9a-f]+ +func \+ 1
--- /dev/null
+#source: pr13082-4.s
+#name: PR ld/13082-4 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +[0-9a-f]+ +func \+ 1
--- /dev/null
+ .text
+ .globl _start
+ .globl ifunc
+ .type ifunc, @gnu_indirect_function
+_start:
+ lea .Ljmp(%rip), %rax
+ifunc:
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad ifunc
--- /dev/null
+#source: pr13082-5.s
+#name: PR ld/13082-5 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +ifunc\(\)+ +ifunc \+ 0
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +ifunc\(\)+ +ifunc \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +ifunc\(\)+ +ifunc \+ 0
--- /dev/null
+#source: pr13082-5.s
+#name: PR ld/13082-5 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
--- /dev/null
+ .text
+ .globl _start
+ .type ifunc, @gnu_indirect_function
+_start:
+ lea .Ljmp(%rip), %rax
+ifunc:
+ jmp *(%rax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad ifunc
--- /dev/null
+#source: pr13082-6.s
+#name: PR ld/13082-6 (a)
+#as: --x32
+#ld: -shared -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
--- /dev/null
+#source: pr13082-6.s
+#name: PR ld/13082-6 (b)
+#as: --x32
+#ld: -pie -melf32_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
run_dump_test "lp64-1"
run_dump_test "lp64-2"
run_dump_test "lp64-3"
+run_dump_test "pr13082-1a"
+run_dump_test "pr13082-1b"
+run_dump_test "pr13082-2a"
+run_dump_test "pr13082-2b"
+run_dump_test "pr13082-3a"
+run_dump_test "pr13082-3b"
+run_dump_test "pr13082-4a"
+run_dump_test "pr13082-4b"
+run_dump_test "pr13082-5a"
+run_dump_test "pr13082-5b"
+run_dump_test "pr13082-6a"
+run_dump_test "pr13082-6b"
# Must be native with the C compiler
if { [isnative] && [which $CC] != 0 } {