From 97d343d40012b1030f1fd219f91efcab180fb3ef Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 26 Apr 2017 15:34:00 -0700 Subject: x86: Add DT_PLTRELSZ/DT_PLTREL/DT_JMPREL for PLT relocation x86, PLT relocation may contain R_386_TLS_DESC or R_X86_64_TLSDESC even though there is no real PLT. We need to add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL if there is a .rel.plt/.rela.plt section. bfd/ * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section. * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section. ld/ * testsuite/ld-i386/tlsdesc2.d: New test. * testsuite/ld-x86-64/tlsdesc2.d: Likewise. --- bfd/elf32-i386.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bfd/elf32-i386.c') diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 9a568ce..78c5d5b 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -3577,14 +3577,14 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) relocation. */ if (!add_dynamic_entry (DT_PLTGOT, 0)) return FALSE; + } - if (htab->elf.srelplt->size != 0) - { - if (!add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_REL) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } + if (htab->elf.srelplt->size != 0) + { + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_REL) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; } if (relocs) -- cgit v1.1