|
|
381f6c |
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c
|
|
|
381f6c |
--- binutils.orig/bfd/elf32-i386.c 2018-03-09 14:43:05.324208873 +0000
|
|
|
381f6c |
+++ binutils-2.30/bfd/elf32-i386.c 2018-03-09 14:43:23.158000456 +0000
|
|
|
381f6c |
@@ -2202,12 +2202,19 @@ elf_i386_relocate_section (bfd *output_b
|
|
|
381f6c |
|
|
|
381f6c |
if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
{
|
|
|
381f6c |
+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat
|
|
|
381f6c |
+ STT_GNU_IFUNC symbol as STT_FUNC. */
|
|
|
381f6c |
+ if (elf_section_type (input_section) == SHT_NOTE)
|
|
|
381f6c |
+ goto skip_ifunc;
|
|
|
381f6c |
/* Dynamic relocs are not propagated for SEC_DEBUGGING
|
|
|
381f6c |
sections because such sections are not SEC_ALLOC and
|
|
|
381f6c |
thus ld.so will not process them. */
|
|
|
381f6c |
if ((input_section->flags & SEC_DEBUGGING) != 0)
|
|
|
381f6c |
continue;
|
|
|
381f6c |
- abort ();
|
|
|
381f6c |
+ _bfd_error_handler (_("%B: error: relocation againt ifunc symbol in non-alloc section %A"),
|
|
|
381f6c |
+ input_bfd, input_section);
|
|
|
381f6c |
+ bfd_set_error (bfd_error_invalid_operation);
|
|
|
381f6c |
+ return FALSE;
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
/* STT_GNU_IFUNC symbol must go through PLT. */
|
|
|
381f6c |
@@ -2421,6 +2428,7 @@ do_ifunc_pointer:
|
|
|
381f6c |
}
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
+ skip_ifunc:
|
|
|
381f6c |
resolved_to_zero = (eh != NULL
|
|
|
381f6c |
&& UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
|
|
|
381f6c |
|
|
|
381f6c |
diff -rup binutils.orig/bfd/elf32-s390.c binutils-2.30/bfd/elf32-s390.c
|
|
|
381f6c |
--- binutils.orig/bfd/elf32-s390.c 2018-03-09 14:43:05.325208861 +0000
|
|
|
381f6c |
+++ binutils-2.30/bfd/elf32-s390.c 2018-03-09 14:43:31.353904647 +0000
|
|
|
381f6c |
@@ -2601,6 +2601,9 @@ elf_s390_relocate_section (bfd *output_b
|
|
|
381f6c |
case R_390_8:
|
|
|
381f6c |
case R_390_16:
|
|
|
381f6c |
case R_390_32:
|
|
|
381f6c |
+ if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
+ break;
|
|
|
381f6c |
+
|
|
|
381f6c |
if (h != NULL
|
|
|
381f6c |
&& s390_is_ifunc_symbol_p (h)
|
|
|
381f6c |
&& h->def_regular)
|
|
|
381f6c |
@@ -2662,9 +2665,6 @@ elf_s390_relocate_section (bfd *output_b
|
|
|
381f6c |
}
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
- if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
- break;
|
|
|
381f6c |
-
|
|
|
381f6c |
if ((bfd_link_pic (info)
|
|
|
381f6c |
&& (h == NULL
|
|
|
381f6c |
|| (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
|
|
381f6c |
Only in binutils-2.30/bfd: elf32-s390.c.orig
|
|
|
381f6c |
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c
|
|
|
381f6c |
--- binutils.orig/bfd/elf64-s390.c 2018-03-09 14:43:05.341208674 +0000
|
|
|
381f6c |
+++ binutils-2.30/bfd/elf64-s390.c 2018-03-09 14:43:31.354904635 +0000
|
|
|
381f6c |
@@ -2559,6 +2559,9 @@ elf_s390_relocate_section (bfd *output_b
|
|
|
381f6c |
case R_390_32:
|
|
|
381f6c |
case R_390_64:
|
|
|
381f6c |
|
|
|
381f6c |
+ if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
+ break;
|
|
|
381f6c |
+
|
|
|
381f6c |
if (h != NULL
|
|
|
381f6c |
&& s390_is_ifunc_symbol_p (h)
|
|
|
381f6c |
&& h->def_regular)
|
|
|
381f6c |
@@ -2621,9 +2624,6 @@ elf_s390_relocate_section (bfd *output_b
|
|
|
381f6c |
}
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
- if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
- break;
|
|
|
381f6c |
-
|
|
|
381f6c |
if ((bfd_link_pic (info)
|
|
|
381f6c |
&& (h == NULL
|
|
|
381f6c |
|| (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
|
|
381f6c |
Only in binutils-2.30/bfd: elf64-s390.c.orig
|
|
|
381f6c |
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c
|
|
|
381f6c |
--- binutils.orig/bfd/elf64-x86-64.c 2018-03-09 14:43:05.344208639 +0000
|
|
|
381f6c |
+++ binutils-2.30/bfd/elf64-x86-64.c 2018-03-09 14:43:23.161000420 +0000
|
|
|
381f6c |
@@ -2499,12 +2499,19 @@ elf_x86_64_relocate_section (bfd *output
|
|
|
381f6c |
|
|
|
381f6c |
if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
{
|
|
|
381f6c |
+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat
|
|
|
381f6c |
+ STT_GNU_IFUNC symbol as STT_FUNC. */
|
|
|
381f6c |
+ if (elf_section_type (input_section) == SHT_NOTE)
|
|
|
381f6c |
+ goto skip_ifunc;
|
|
|
381f6c |
/* Dynamic relocs are not propagated for SEC_DEBUGGING
|
|
|
381f6c |
sections because such sections are not SEC_ALLOC and
|
|
|
381f6c |
thus ld.so will not process them. */
|
|
|
381f6c |
if ((input_section->flags & SEC_DEBUGGING) != 0)
|
|
|
381f6c |
continue;
|
|
|
381f6c |
- abort ();
|
|
|
381f6c |
+ _bfd_error_handler (_("%B: error: relocation againt ifunc symbol in non-alloc section %A"),
|
|
|
381f6c |
+ input_bfd, input_section);
|
|
|
381f6c |
+ bfd_set_error (bfd_error_invalid_operation);
|
|
|
381f6c |
+ return FALSE;
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
switch (r_type)
|
|
|
381f6c |
@@ -2722,6 +2729,7 @@ do_ifunc_pointer:
|
|
|
381f6c |
}
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
+ skip_ifunc:
|
|
|
381f6c |
resolved_to_zero = (eh != NULL
|
|
|
381f6c |
&& UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
|
|
|
381f6c |
|
|
|
381f6c |
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
|
|
|
381f6c |
--- binutils.orig/bfd/elfnn-aarch64.c 2018-03-09 14:43:05.337208721 +0000
|
|
|
381f6c |
+++ binutils-2.30/bfd/elfnn-aarch64.c 2018-03-09 14:43:31.355904624 +0000
|
|
|
381f6c |
@@ -4987,6 +4987,11 @@ elfNN_aarch64_final_link_relocate (reloc
|
|
|
381f6c |
|
|
|
381f6c |
if ((input_section->flags & SEC_ALLOC) == 0)
|
|
|
381f6c |
{
|
|
|
381f6c |
+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat
|
|
|
381f6c |
+ STT_GNU_IFUNC symbol as STT_FUNC. */
|
|
|
381f6c |
+ if (elf_section_type (input_section) == SHT_NOTE)
|
|
|
381f6c |
+ goto skip_ifunc;
|
|
|
381f6c |
+
|
|
|
381f6c |
/* Dynamic relocs are not propagated for SEC_DEBUGGING
|
|
|
381f6c |
sections because such sections are not SEC_ALLOC and
|
|
|
381f6c |
thus ld.so will not process them. */
|
|
|
381f6c |
@@ -5180,6 +5185,7 @@ bad_ifunc_reloc:
|
|
|
381f6c |
}
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
+ skip_ifunc:
|
|
|
381f6c |
resolved_to_zero = (h != NULL
|
|
|
381f6c |
&& UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
|
|
|
381f6c |
|
|
|
381f6c |
Only in binutils-2.30/bfd: elfnn-aarch64.c.orig
|
|
|
381f6c |
diff -rup binutils.orig/bfd/elfxx-sparc.c binutils-2.30/bfd/elfxx-sparc.c
|
|
|
381f6c |
--- binutils.orig/bfd/elfxx-sparc.c 2018-03-09 14:43:05.333208768 +0000
|
|
|
381f6c |
+++ binutils-2.30/bfd/elfxx-sparc.c 2018-03-09 14:43:31.355904624 +0000
|
|
|
381f6c |
@@ -3026,7 +3026,13 @@ _bfd_sparc_elf_relocate_section (bfd *ou
|
|
|
381f6c |
|
|
|
381f6c |
if ((input_section->flags & SEC_ALLOC) == 0
|
|
|
381f6c |
|| h->plt.offset == (bfd_vma) -1)
|
|
|
381f6c |
- abort ();
|
|
|
381f6c |
+ {
|
|
|
381f6c |
+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat
|
|
|
381f6c |
+ STT_GNU_IFUNC symbol as STT_FUNC. */
|
|
|
381f6c |
+ if (elf_section_type (input_section) == SHT_NOTE)
|
|
|
381f6c |
+ goto skip_ifunc;
|
|
|
381f6c |
+ abort ();
|
|
|
381f6c |
+ }
|
|
|
381f6c |
|
|
|
381f6c |
plt_sec = htab->elf.splt;
|
|
|
381f6c |
if (! plt_sec)
|
|
|
381f6c |
@@ -3130,6 +3136,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
|
|
|
381f6c |
}
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
+ skip_ifunc:
|
|
|
381f6c |
eh = (struct _bfd_sparc_elf_link_hash_entry *) h;
|
|
|
381f6c |
resolved_to_zero = (eh != NULL
|
|
|
381f6c |
&& UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
|
|
|
381f6c |
Only in binutils-2.30/bfd: elfxx-sparc.c.orig
|
|
|
381f6c |
diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp
|
|
|
381f6c |
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2018-03-09 14:43:04.844214486 +0000
|
|
|
381f6c |
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp 2018-03-09 14:43:31.355904624 +0000
|
|
|
381f6c |
@@ -47,6 +47,9 @@ if ![check_shared_lib_support] {
|
|
|
381f6c |
return
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
+# This test does not need a compiler...
|
|
|
381f6c |
+run_dump_test "ifuncmod5"
|
|
|
381f6c |
+
|
|
|
381f6c |
# We need a working compiler. (Strictly speaking this is
|
|
|
381f6c |
# not true, we could use target specific assembler files).
|
|
|
381f6c |
if { [which $CC] == 0 } {
|
|
|
381f6c |
Only in binutils-2.30: testsuite
|
|
|
381f6c |
--- /dev/null 2018-03-09 07:59:09.608015200 +0000
|
|
|
381f6c |
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifuncmod5.s 2018-03-09 14:45:45.698334500 +0000
|
|
|
381f6c |
@@ -0,0 +1,105 @@
|
|
|
381f6c |
+ .file "ifuncmod5.c"
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .text
|
|
|
381f6c |
+ .type ifuncmod5.c, STT_NOTYPE
|
|
|
381f6c |
+ifuncmod5.c:
|
|
|
381f6c |
+ .size ifuncmod5.c, 0
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .pushsection .gnu.build.attributes, "", %note
|
|
|
381f6c |
+ .balign 4
|
|
|
381f6c |
+ .dc.l 8
|
|
|
381f6c |
+ .dc.l 16
|
|
|
381f6c |
+ .dc.l 0x100
|
|
|
381f6c |
+ .asciz "GA$?3p4"
|
|
|
381f6c |
+ .dc.a ifuncmod5.c
|
|
|
381f6c |
+ .dc.a ifuncmod5.c_end
|
|
|
381f6c |
+ .popsection
|
|
|
381f6c |
+
|
|
|
381f6c |
+.Ltext0:
|
|
|
381f6c |
+#APP
|
|
|
381f6c |
+ .protected global
|
|
|
381f6c |
+ .type foo, %gnu_indirect_function
|
|
|
381f6c |
+ .type foo_hidden, %gnu_indirect_function
|
|
|
381f6c |
+ .type foo_protected, %gnu_indirect_function
|
|
|
381f6c |
+ .hidden foo_hidden
|
|
|
381f6c |
+ .protected foo_protected
|
|
|
381f6c |
+#NO_APP
|
|
|
381f6c |
+ .align 8
|
|
|
381f6c |
+ .type one, %function
|
|
|
381f6c |
+one:
|
|
|
381f6c |
+ .dc.l 0
|
|
|
381f6c |
+ .size one, .-one
|
|
|
381f6c |
+ .align 8
|
|
|
381f6c |
+
|
|
|
381f6c |
+.globl foo
|
|
|
381f6c |
+ .type foo, %function
|
|
|
381f6c |
+foo:
|
|
|
381f6c |
+ .dc.l 0
|
|
|
381f6c |
+ .size foo, .-foo
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .pushsection .gnu.build.attributes
|
|
|
381f6c |
+ .dc.l 6
|
|
|
381f6c |
+ .dc.l 16
|
|
|
381f6c |
+ .dc.l 0x101
|
|
|
381f6c |
+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0
|
|
|
381f6c |
+ .dc.b 0, 0
|
|
|
381f6c |
+ .dc.a foo
|
|
|
381f6c |
+ .dc.a foo_end
|
|
|
381f6c |
+ .popsection
|
|
|
381f6c |
+
|
|
|
381f6c |
+foo_end:
|
|
|
381f6c |
+ .align 8
|
|
|
381f6c |
+.globl foo_hidden
|
|
|
381f6c |
+ .type foo_hidden, %function
|
|
|
381f6c |
+foo_hidden:
|
|
|
381f6c |
+ .dc.l 0
|
|
|
381f6c |
+ .size foo_hidden, .-foo_hidden
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .pushsection .gnu.build.attributes
|
|
|
381f6c |
+ .dc.l 6
|
|
|
381f6c |
+ .dc.l 16
|
|
|
381f6c |
+ .dc.l 0x101
|
|
|
381f6c |
+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0
|
|
|
381f6c |
+ .dc.b 0, 0
|
|
|
381f6c |
+ .dc.a foo_hidden
|
|
|
381f6c |
+ .dc.a foo_hidden_end
|
|
|
381f6c |
+ .popsection
|
|
|
381f6c |
+
|
|
|
381f6c |
+foo_hidden_end:
|
|
|
381f6c |
+ .align 8
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .globl foo_protected
|
|
|
381f6c |
+ .type foo_protected, %function
|
|
|
381f6c |
+foo_protected:
|
|
|
381f6c |
+ .dc.l 0
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .size foo_protected, .-foo_protected
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .pushsection .gnu.build.attributes
|
|
|
381f6c |
+ .dc.l 6
|
|
|
381f6c |
+ .dc.l 16
|
|
|
381f6c |
+ .dc.l 0x101
|
|
|
381f6c |
+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0
|
|
|
381f6c |
+ .dc.b 0, 0
|
|
|
381f6c |
+ .dc.a foo_protected
|
|
|
381f6c |
+ .dc.a foo_protected_end
|
|
|
381f6c |
+ .popsection
|
|
|
381f6c |
+
|
|
|
381f6c |
+foo_protected_end:
|
|
|
381f6c |
+ .globl global
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .data
|
|
|
381f6c |
+ .align 4
|
|
|
381f6c |
+ .type global, %object
|
|
|
381f6c |
+ .size global, 4
|
|
|
381f6c |
+global:
|
|
|
381f6c |
+ .long -1
|
|
|
381f6c |
+
|
|
|
381f6c |
+ .text
|
|
|
381f6c |
+ .Letext0:
|
|
|
381f6c |
+
|
|
|
381f6c |
+ifuncmod5.c_end:
|
|
|
381f6c |
+ .type ifuncmod5.c_end, STT_NOTYPE
|
|
|
381f6c |
+ .size ifuncmod5.c_end, 0
|
|
|
381f6c |
+
|
|
|
381f6c |
+
|
|
|
381f6c |
--- /dev/null 2018-03-09 07:59:09.608015200 +0000
|
|
|
381f6c |
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifuncmod5.d 2018-03-09 14:45:45.698334500 +0000
|
|
|
381f6c |
@@ -0,0 +1,8 @@
|
|
|
381f6c |
+# name: Reloc against IFUNC symbol in NOTE section
|
|
|
381f6c |
+# ld: -shared
|
|
|
381f6c |
+# nm: -p
|
|
|
381f6c |
+
|
|
|
381f6c |
+# We do not actually care about the notes at the moment.
|
|
|
381f6c |
+# The purpose of this test is to make sure that the link completes successfully.
|
|
|
381f6c |
+#pass
|
|
|
381f6c |
+
|