+2016-03-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19827
+ * elf32-i386.c (elf_i386_check_relocs): Bind defined symbol
+ locally in PIE.
+ (elf_i386_relocate_section): Likewise.
+ * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
+ (elf_x86_64_relocate_section): Likewise.
+
2016-03-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19807
&& (sec->flags & SEC_ALLOC) != 0
&& (r_type != R_386_PC32
|| (h != NULL
- && (! SYMBOLIC_BIND (info, h)
+ && (! (bfd_link_pie (info)
+ || SYMBOLIC_BIND (info, h))
|| h->root.type == bfd_link_hash_defweak
|| !h->def_regular))))
|| (ELIMINATE_COPY_RELOCS
else if (h != NULL
&& h->dynindx != -1
&& (r_type == R_386_PC32
- || !bfd_link_pic (info)
- || !SYMBOLIC_BIND (info, h)
+ || !(bfd_link_executable (info)
+ || SYMBOLIC_BIND (info, h))
|| !h->def_regular))
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
else
&& (sec->flags & SEC_ALLOC) != 0
&& (! IS_X86_64_PCREL_TYPE (r_type)
|| (h != NULL
- && (! SYMBOLIC_BIND (info, h)
+ && (! (bfd_link_pie (info)
+ || SYMBOLIC_BIND (info, h))
|| h->root.type == bfd_link_hash_defweak
|| !h->def_regular))))
|| (ELIMINATE_COPY_RELOCS
else if (h != NULL
&& h->dynindx != -1
&& (IS_X86_64_PCREL_TYPE (r_type)
- || ! bfd_link_pic (info)
- || ! SYMBOLIC_BIND (info, h)
+ || !(bfd_link_executable (info)
+ || SYMBOLIC_BIND (info, h))
|| ! h->def_regular))
{
if ((r_type != R_X86_64_PC64 && r_type != R_X86_64_64)
+2016-03-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19827
+ * testsuite/ld-i386/i386.exp: Run PR ld/19827 tests.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+ * testsuite/ld-i386/pr19827.rd: New file.
+ * testsuite/ld-i386/pr19827a.S: Likewise.
+ * testsuite/ld-i386/pr19827b.S: Likewise.
+ * testsuite/ld-x86-64/pr19827.rd: Likewise.
+ * testsuite/ld-x86-64/pr19827a.S: Likewise.
+ * testsuite/ld-x86-64/pr19827b.S: Likewise.
+
2016-03-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19807
"--32" {pr17709a.s} {} "libpr17709.so"}
{"PR ld/17709 (2)" "-melf_i386 tmpdir/libpr17709.so" ""
"--32" {pr17709b.s} {{readelf -r pr17709.rd}} "pr17709"}
+ {"Build pr19827a.o" "" ""
+ "--32" { pr19827a.S }}
+ {"Build pr19827b.so" "-melf_i386 -shared" ""
+ "--32" { pr19827b.S } {} "pr19827b.so"}
+ {"Build pr19827" "-melf_i386 -pie tmpdir/pr19827a.o tmpdir/pr19827b.so" ""
+ "--32" { dummy.s } {{readelf {-rW} pr19827.rd}} "pr19827"}
+ {"Build pr19827.so" "-melf_i386 -shared -Bsymbolic" ""
+ "--32" { pr19827a.S } {{readelf {-rW} pr19827.rd}} "pr19827.so"}
}
# So as to avoid rewriting every last test case here in a nacl variant,
--- /dev/null
+#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 +
--- /dev/null
+ .text
+ .global _start
+_start:
+ .dc.a foo
+ .data
+ .globl foo
+foo:
+ .byte 0
--- /dev/null
+ .data
+ .dc.a foo
--- /dev/null
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
--- /dev/null
+ .text
+ .global _start
+_start:
+ .dc.a foo
+ .data
+ .globl foo
+foo:
+ .byte 0
--- /dev/null
+ .data
+ .dc.a foo
"--64" {pr17709a.s} {} "libpr17709.so"}
{"PR ld/17709 (2)" "-melf_x86_64 tmpdir/libpr17709.so" ""
"--64" {pr17709b.s} {{readelf -rW pr17709.rd}} "pr17709"}
+ {"Build pr19827a.o" "" ""
+ "--64" { pr19827a.S }}
+ {"Build pr19827b.so" "-melf_x86_64 -shared" ""
+ "--64" { pr19827b.S } {} "pr19827b.so"}
+ {"Build pr19827" "-melf_x86_64 -pie tmpdir/pr19827a.o tmpdir/pr19827b.so" ""
+ "--64" { dummy.s } {{readelf {-rW} pr19827.rd}} "pr19827"}
+ {"Build pr19827.so" "-melf_x86_64 -shared -Bsymbolic" ""
+ "--64" { pr19827a.S } {{readelf {-rW} pr19827.rd}} "pr19827.so"}
}
# So as to avoid rewriting every last test case here in a nacl variant,