+2015-09-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19031
+ * elf32-i386.c (elf_i386_check_relocs): Set
+ pointer_equality_needed for R_386_PC32 reloc in non-code
+ sections.
+
2015-09-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19013
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
h->plt.refcount += 1;
- if (r_type != R_386_PC32)
+ if (r_type == R_386_PC32)
+ {
+ /* Since something like ".long foo - ." may be used
+ as pointer, make sure that PLT is used if foo is
+ a function defined in a shared library. */
+ if ((sec->flags & SEC_CODE) == 0)
+ h->pointer_equality_needed = 1;
+ }
+ else
{
h->pointer_equality_needed = 1;
/* R_386_32 can be resolved at run-time. */
+2015-09-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19031
+ * ld-i386/i386.exp: Run PR ld/19031 test.
+ * ld/testsuite/ld-i386/pr19031.out: New file.
+ * ld/testsuite/ld-i386/pr19031a.c: Likewise.
+ * ld/testsuite/ld-i386/pr19031b.S: Likewise.
+ * ld/testsuite/ld-i386/pr19031c.c: Likewise.
+
2015-09-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19013
{{readelf {-Wrd} pr18900b.rd}} \
"pr18900b" \
] \
+ [list \
+ "Build pr19031.so" \
+ "-shared" \
+ "-fPIC" \
+ { pr19031a.c } \
+ "" \
+ "pr19031.so" \
+ ] \
]
run_ld_link_exec_tests [] [list \
"pr18900" \
"pr18900.out" \
] \
+ [list \
+ "Run pr19031" \
+ "tmpdir/pr19031.so" \
+ "" \
+ { pr19031b.S pr19031c.c } \
+ "pr19031" \
+ "pr19031.out" \
+ ] \
]
}
--- /dev/null
+void
+f (void)
+{
+}
--- /dev/null
+ .text
+ .globl g
+ .type g, @function
+g:
+ calll .Lfoo
+.Lfoo:
+ popl %eax
+.Lbar:
+ addl $_GLOBAL_OFFSET_TABLE_+(.Lbar-.Lfoo), %eax
+ movl f@GOT(%eax), %eax
+ ret
+
+ .globl h
+ .type h, @function
+h:
+ leal zed, %eax
+ movl zed, %ebx
+ addl %ebx, %eax
+ ret
+
+ .data
+zed:
+ .long f - .
--- /dev/null
+#include <stdio.h>
+
+extern void *h (void);
+extern void *g (void);
+
+int
+main (void)
+{
+
+ if (h () == g ())
+ printf ("OK\n");
+
+ return 0;
+}