+2015-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/17847
+ * elf64-x86-64.c (elf_x86_64_relocate_section): Don't complain
+ about -fPIC if the symbol is undefined when building executable.
+
2015-01-15 Nick Clifton <nickc@redhat.com>
PR binutils/17512
case R_X86_64_PC16:
case R_X86_64_PC32:
case R_X86_64_PC32_BND:
+ /* Don't complain about -fPIC if the symbol is undefined when
+ building executable. */
if (info->shared
&& (input_section->flags & SEC_ALLOC) != 0
&& (input_section->flags & SEC_READONLY) != 0
- && h != NULL)
+ && h != NULL
+ && !(info->executable
+ && h->root.type == bfd_link_hash_undefined))
{
bfd_boolean fail = FALSE;
bfd_boolean branch
break;
/* Don't copy a pc-relative relocation into the output file
- if the symbol needs copy reloc. */
+ if the symbol needs copy reloc or the symbol is undefined
+ when building executable. */
if ((info->shared
&& !(info->executable
&& h != NULL
- && (h->needs_copy || eh->needs_copy)
+ && (h->needs_copy
+ || eh->needs_copy
+ || h->root.type == bfd_link_hash_undefined)
&& IS_X86_64_PCREL_TYPE (r_type))
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+2015-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/17847
+ * ld-x86-64/pie1.d: New file.
+ * ld-x86-64/pie1.s: Likwise.
+ * ld-x86-64/x86-64.exp: Run pie1.
+
2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
* ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test.
--- /dev/null
+#name: PIE with undefined symbol
+#as: --64
+#ld: -pie -melf_x86_64 --noinhibit-exec
+#readelf: -s --wide
+#warning: \A[^\n]*\.o[^\n]*In function `_start':\n[^\n]*: undefined reference to `foo'\Z
+
+#...
+ +[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND foo
+#pass