+2011-10-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/13302
+ * elf32-i386.c (elf_i386_relocate_section): Replace
+ R_386_IRELATIVE with R_386_RELATIVE.
+
+ * elf64-x86-64.c (elf_x86_64_relocate_section): Replace
+ R_X86_64_IRELATIVE with R_X86_64_RELATIVE.
+
2011-10-21 H.J. Lu <hongjiu.lu@intel.com>.
* elf32-i386.c (elf_i386_relocate_section): Fix a typo in
bfd_byte *loc;
asection *sreloc;
bfd_vma offset;
+ bfd_boolean relocate;
/* Need a dynamic relocation to get the real function
adddress. */
|| info->executable)
{
/* This symbol is resolved locally. */
- outrel.r_info = ELF32_R_INFO (0, R_386_IRELATIVE);
- bfd_put_32 (output_bfd,
- (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset),
- contents + offset);
+ outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
+ relocate = TRUE;
}
else
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+ {
+ outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+ relocate = FALSE;
+ }
sreloc = htab->elf.irelifunc;
loc = sreloc->contents;
we need to include the symbol value so that it
becomes an addend for the dynamic reloc. For an
internal symbol, we have updated addend. */
- continue;
+ if (! relocate)
+ continue;
}
/* FALLTHROUGH */
case R_386_PC32:
{
Elf_Internal_Rela outrel;
asection *sreloc;
+ bfd_boolean relocate;
/* Need a dynamic relocation to get the real function
address. */
|| info->executable)
{
/* This symbol is resolved locally. */
- outrel.r_info = htab->r_info (0, R_X86_64_IRELATIVE);
- outrel.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
+ outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE);
+ outrel.r_addend = relocation;
+ relocate = FALSE;
}
else
{
outrel.r_info = htab->r_info (h->dynindx, r_type);
outrel.r_addend = 0;
+ relocate = FALSE;
}
sreloc = htab->elf.irelifunc;
we need to include the symbol value so that it
becomes an addend for the dynamic reloc. For an
internal symbol, we have updated addend. */
- continue;
+ if (! relocate)
+ continue;
}
/* FALLTHROUGH */
case R_X86_64_PC32:
2011-10-21 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13302
+ * ld-i386/i386.exp: Run pr13302.
+
+ * ld-i386/pr13302.d: New.
+ * ld-i386/pr13302.s: Likewise.
+
+ * ld-x86-64/pr13082-5b.d: Updated.
+ * ld-x86-64/pr13082-6a.d: Likewise.
+ * ld-x86-64/pr13082-6b.d: Likewise.
+
+2011-10-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/13302
* ld-ifunc/ifunc-16-i386.d: New.
* ld-ifunc/ifunc-16-x86-64.d: Likewise.
* ld-ifunc/ifunc-16-x86.s: Likewise.
run_dump_test "compressed1"
run_dump_test "pr12627"
+run_dump_test "pr13302"
--- /dev/null
+#name: PR ld/13302
+#as: --32
+#ld: -pie -melf_i386
+#readelf: -r --wide
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_IRELATIVE +
--- /dev/null
+ .text
+ .globl _start
+ .type ifunc, @gnu_indirect_function
+_start:
+ lea .Ljmp@GOTOFF(%ebx), %eax
+ifunc:
+ jmp *(%eax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .align 4
+.Ljmp:
+ .long ifunc
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]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[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
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]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[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
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]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[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