From 97dc35c88dd470465a99edeb0b491012a368f2bf Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 11 Aug 2015 12:58:52 -0700 Subject: Skip IFUNC relocations in debug sections Skip IFUNC relocations in debug sections ignored by ld.so. bfd/ PR ld/18808 * elf32-i386.c (elf_i386_relocate_section): Skip IFUNC relocations in debug sections. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. ld/testsuite/ PR ld/18808 * ld-ifunc/ifunc.exp: Add a test for PR ld/18808. * ld-ifunc/pr18808.out: New file. * ld-ifunc/pr18808a.c: Likewise. * ld-ifunc/pr18808b.c: Likewise. --- bfd/ChangeLog | 7 +++++++ bfd/elf32-i386.c | 12 ++++++++++-- bfd/elf64-x86-64.c | 12 ++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f152cdc..7912368 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2015-08-11 H.J. Lu + + PR ld/18808 + * elf32-i386.c (elf_i386_relocate_section): Skip IFUNC + relocations in debug sections. + * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. + 2015-08-11 Peter Zotov PR ld/18759 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 92e7f72..fb87421 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -3503,8 +3503,16 @@ elf_i386_relocate_section (bfd *output_bfd, bfd_vma plt_index; const char *name; - if ((input_section->flags & SEC_ALLOC) == 0 - || h->plt.offset == (bfd_vma) -1) + if ((input_section->flags & SEC_ALLOC) == 0) + { + /* Dynamic relocs are not propagated for SEC_DEBUGGING + sections because such sections are not SEC_ALLOC and + thus ld.so will not process them. */ + if ((input_section->flags & SEC_DEBUGGING) != 0) + break; + abort (); + } + else if (h->plt.offset == (bfd_vma) -1) abort (); /* STT_GNU_IFUNC symbol must go through PLT. */ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index a4dfdc8..4b83032 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3786,8 +3786,16 @@ elf_x86_64_relocate_section (bfd *output_bfd, bfd_vma plt_index; const char *name; - if ((input_section->flags & SEC_ALLOC) == 0 - || h->plt.offset == (bfd_vma) -1) + if ((input_section->flags & SEC_ALLOC) == 0) + { + /* Dynamic relocs are not propagated for SEC_DEBUGGING + sections because such sections are not SEC_ALLOC and + thus ld.so will not process them. */ + if ((input_section->flags & SEC_DEBUGGING) != 0) + break; + abort (); + } + else if (h->plt.offset == (bfd_vma) -1) abort (); /* STT_GNU_IFUNC symbol must go through PLT. */ -- cgit v1.1