This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld -pie -O1: failed to set dynamic section sizes: Invalid operation
- From: Nick Clifton <nickc at redhat dot com>
- To: Michael Weiser <michael at weiser dot dinsnail dot net>, binutils at sourceware dot org
- Date: Fri, 16 Jun 2017 15:17:49 +0100
- Subject: Re: ld -pie -O1: failed to set dynamic section sizes: Invalid operation
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=nickc at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C8B4DB16A
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C8B4DB16A
- References: <20170615091704.GB27246@weiser.dinsnail.net>
Hi Michael,
> # ld -o t t.o -v -pie -O1 GNU ld (Gentoo 2.28 p1.1) 2.28 /usr/bin/ld:
> failed to set dynamic section sizes: Invalid operation
This was due to a snafu in the linker's code to compute the size of the
dynamic string and symbol tables. If there were no symbols that needed
to be in these tables, the code was failing rather than reporting no error.
I have checked in a small patch to fix the problem. Please try the mainline
linker sources to see it the issue is now fixed for you.
Cheers
Nick
bfd/ChangeLog
2017-06-16 Nick Clifton <nickc@redhat.com>
* elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
bucketlist is empty because there are no symbols to add to the
list.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 1a83b88..e35ec63 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -6940,7 +6940,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
= compute_bucket_count (info, hashcodes, nsyms, 0);
free (hashcodes);
- if (bucketcount == 0)
+ if (bucketcount == 0 && nsyms > 0)
return FALSE;
elf_hash_table (info)->bucketcount = bucketcount;