This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Nios II build_id fix
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: Cesar Philippidis <cesar at codesourcery dot com>
- Cc: <binutils at sourceware dot org>, <amodra at gmail dot com>
- Date: Thu, 10 Apr 2014 18:18:09 -0600
- Subject: Re: [patch] Nios II build_id fix
- Authentication-results: sourceware.org; auth=none
- References: <533EF156 dot 3030504 at codesourcery dot com> <20140405013150 dot GI18201 at bubble dot grove dot modra dot org> <5340C6FA dot 2010503 at codesourcery dot com> <20140406051208 dot GA13391 at bubble dot grove dot modra dot org> <53449137 dot 5000902 at codesourcery dot com>
On 04/08/2014 06:15 PM, Cesar Philippidis wrote:
Checking for dynobjs seemed to work out. I've tested this patch on both
ELF and Linux Nios II targets. Is it OK?
Thanks. I've checked in this version, with expanded comments to better
explain what is going on.
-Sandra
2014-04-10 Cesar Philippidis <cesar@codesourcery.com>
bfd/
* elf32-nios2.c (nios2_elf32_build_stubs): Ignore dynobjs
when building function stubs.
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 3a44f1d..678f2e3 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -2013,16 +2013,21 @@ nios2_elf32_build_stubs (struct bfd_link_info *info)
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
stub_sec = stub_sec->next)
- {
- bfd_size_type size;
-
- /* Allocate memory to hold the linker stubs. */
- size = stub_sec->size;
- stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
- if (stub_sec->contents == NULL && size != 0)
- return FALSE;
- stub_sec->size = 0;
- }
+ /* The stub_bfd may contain non-stub sections if it is also the
+ dynobj. Any such non-stub sections are created with the
+ SEC_LINKER_CREATED flag set, while stub sections do not
+ have that flag. Ignore any non-stub sections here. */
+ if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
+ {
+ bfd_size_type size;
+
+ /* Allocate memory to hold the linker stubs. */
+ size = stub_sec->size;
+ stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
+ if (stub_sec->contents == NULL && size != 0)
+ return FALSE;
+ stub_sec->size = 0;
+ }
/* Build the stubs as directed by the stub hash table. */
table = &htab->bstab;