[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ld: spurious empty .plt/.rela.plt sections generated
From: |
H.J. Lu |
Subject: |
Re: ld: spurious empty .plt/.rela.plt sections generated |
Date: |
Sat, 30 Apr 2011 18:13:17 -0700 |
On Sat, Apr 30, 2011 at 4:57 PM, Alan Modra <address@hidden> wrote:
> On Fri, Apr 29, 2011 at 05:07:33PM -0700, Roland McGrath wrote:
>> I am seeing a strange thing. The (BFD) linker spuriously generates .plt
>> and .rela.plt sections (both empty) for a link that has no need for them.
>> It's reproduced with a trivial example, and seen on today's binutils trunk.
>> Gold does not produce the empty sections.
>
> HJ, please verify that this fix doesn't break anything else.
>
> Index: bfd/elf64-x86-64.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
> retrieving revision 1.223
> diff -u -p -r1.223 elf64-x86-64.c
> --- bfd/elf64-x86-64.c 23 Apr 2011 01:16:31 -0000 1.223
> +++ bfd/elf64-x86-64.c 30 Apr 2011 23:50:57 -0000
> @@ -1261,7 +1261,9 @@ elf_x86_64_check_relocs (bfd *abfd, stru
> case R_X86_64_PLT32:
> case R_X86_64_GOTPCREL:
> case R_X86_64_GOTPCREL64:
> - if (!_bfd_elf_create_ifunc_sections (abfd, info))
> + if (htab->elf.dynobj == NULL)
> + htab->elf.dynobj = abfd;
> + if (!_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info))
> return FALSE;
> break;
> }
> Index: bfd/elf32-i386.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-i386.c,v
> retrieving revision 1.251
> diff -u -p -r1.251 elf32-i386.c
> --- bfd/elf32-i386.c 23 Apr 2011 01:16:31 -0000 1.251
> +++ bfd/elf32-i386.c 30 Apr 2011 23:50:59 -0000
> @@ -1376,7 +1376,9 @@ elf_i386_check_relocs (bfd *abfd,
> case R_386_PLT32:
> case R_386_GOT32:
> case R_386_GOTOFF:
> - if (!_bfd_elf_create_ifunc_sections (abfd, info))
> + if (htab->elf.dynobj == NULL)
> + htab->elf.dynobj = abfd;
> + if (!_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info))
> return FALSE;
> break;
> }
It works.
Thanks.
--
H.J.