X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf-ifunc.c;h=58948e32f112787c7afa9da42d2306541a90c56b;hb=c0c3707ff46ccfb78ea175dd42d628d8c90dca8b;hp=1fab4401360ef1d680ca3763fca46c5f1be71190;hpb=219d1afa89d0d53ca93a684cac341f16470f3ca0;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c index 1fab440136..58948e32f1 100644 --- a/bfd/elf-ifunc.c +++ b/bfd/elf-ifunc.c @@ -1,5 +1,5 @@ /* ELF STT_GNU_IFUNC support. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -62,8 +62,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_with_flags (abfd, rel_sec, flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelifunc = s; } @@ -73,7 +72,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) for static executables. */ s = bfd_make_section_with_flags (abfd, ".iplt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; htab->iplt = s; @@ -82,8 +81,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.iplt" : ".rel.iplt"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelplt = s; @@ -94,8 +92,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) else s = bfd_make_section_with_flags (abfd, ".igot", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->igotplt = s; } @@ -131,8 +128,15 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info, the resolved function may be used. But in non-PIC executable, the address of its .plt slot may be used. Pointer equality may not work correctly. PIE or non-PLT reference should be used if - pointer equality is required here. */ + pointer equality is required here. + + If STT_GNU_IFUNC symbol is defined in position-dependent executable, + backend should change it to the normal function and set its address + to its PLT entry which should be resolved by R_*_IRELATIVE at + run-time. All external references should be resolved to its PLT in + executable. */ if (!need_dynreloc + && !(bfd_link_pde (info) && h->def_regular) && (h->dynindx != -1 || info->export_dynamic) && h->pointer_equality_needed) @@ -140,7 +144,7 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info, info->callbacks->einfo /* xgettext:c-format */ (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer " - "equality in `%B' can not be used when making an " + "equality in `%pB' can not be used when making an " "executable; recompile with -fPIE and relink with -pie\n"), h->root.root.string, h->root.u.def.section->owner);