From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 6/8] or1k: refactor: Rename p to sec_relocs
Date: Fri, 15 May 2020 06:00:16 +0900 [thread overview]
Message-ID: <20200514210018.2749462-7-shorne@gmail.com> (raw)
In-Reply-To: <20200514210018.2749462-1-shorne@gmail.com>
The symbol name p was not very meaningful and causing me confusion
while debugging this code. Change to a more meaninful name.
bfd/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* elf32-or1k.c (allocate_dynrelocs, readonly_dynrelocs,
or1k_elf_check_relocs, or1k_elf_size_dynamic_sections): Rename
p to sec_relocs.
---
bfd/elf32-or1k.c | 86 ++++++++++++++++++++++++++----------------------
1 file changed, 47 insertions(+), 39 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index ca1b61fe1c..22c316d042 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2104,7 +2104,7 @@ or1k_elf_check_relocs (bfd *abfd,
&& (h->root.type == bfd_link_hash_defweak
|| !h->def_regular)))
{
- struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs *sec_relocs;
struct elf_dyn_relocs **head;
/* When creating a shared object, we must copy these
@@ -2172,24 +2172,26 @@ or1k_elf_check_relocs (bfd *abfd,
head = (struct elf_dyn_relocs **) vpp;
}
- p = *head;
- if (p == NULL || p->sec != sec)
+ sec_relocs = *head;
+ /* Allocate this sections dynamic reolcations structure if this
+ is a new section. */
+ if (sec_relocs == NULL || sec_relocs->sec != sec)
{
- size_t amt = sizeof *p;
- p = ((struct elf_dyn_relocs *)
- bfd_alloc (htab->root.dynobj, amt));
- if (p == NULL)
+ size_t amt = sizeof *sec_relocs;
+ sec_relocs = ((struct elf_dyn_relocs *)
+ bfd_alloc (htab->root.dynobj, amt));
+ if (sec_relocs == NULL)
return FALSE;
- p->next = *head;
- *head = p;
- p->sec = sec;
- p->count = 0;
- p->pc_count = 0;
+ sec_relocs->next = *head;
+ *head = sec_relocs;
+ sec_relocs->sec = sec;
+ sec_relocs->count = 0;
+ sec_relocs->pc_count = 0;
}
- p->count += 1;
+ sec_relocs->count += 1;
if (r_type == R_OR1K_INSN_REL_26)
- p->pc_count += 1;
+ sec_relocs->pc_count += 1;
}
}
break;
@@ -2549,15 +2551,17 @@ or1k_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
- struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs *sec_relocs;
struct elf_or1k_link_hash_entry *eh = (struct elf_or1k_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ for (sec_relocs = eh->dyn_relocs;
+ sec_relocs != NULL;
+ sec_relocs = sec_relocs->next)
{
- asection *s = p->sec->output_section;
+ asection *s = sec_relocs->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
- return p->sec;
+ return sec_relocs->sec;
}
return NULL;
}
@@ -2750,7 +2754,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
struct bfd_link_info *info;
struct elf_or1k_link_hash_table *htab;
struct elf_or1k_link_hash_entry *eh;
- struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs *sec_relocs;
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -2863,14 +2867,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
{
struct elf_dyn_relocs **pp;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL;)
+ for (pp = &eh->dyn_relocs; (sec_relocs = *pp) != NULL;)
{
- p->count -= p->pc_count;
- p->pc_count = 0;
- if (p->count == 0)
- *pp = p->next;
+ sec_relocs->count -= sec_relocs->pc_count;
+ sec_relocs->pc_count = 0;
+ if (sec_relocs->count == 0)
+ *pp = sec_relocs->next;
else
- pp = &p->next;
+ pp = &sec_relocs->next;
}
}
@@ -2926,10 +2930,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
}
/* Finally, allocate space. */
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ for (sec_relocs = eh->dyn_relocs;
+ sec_relocs != NULL;
+ sec_relocs = sec_relocs->next)
{
- asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->size += p->count * sizeof (Elf32_External_Rela);
+ asection *sreloc = elf_section_data (sec_relocs->sec)->sreloc;
+ sreloc->size += sec_relocs->count * sizeof (Elf32_External_Rela);
}
return TRUE;
@@ -3009,26 +3015,28 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for (s = ibfd->sections; s != NULL; s = s->next)
{
- struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs *sec_relocs;
- for (p = ((struct elf_dyn_relocs *)
- elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
+ for (sec_relocs = ((struct elf_dyn_relocs *)
+ elf_section_data (s)->local_dynrel);
+ sec_relocs != NULL;
+ sec_relocs = sec_relocs->next)
{
- if (! bfd_is_abs_section (p->sec)
- && bfd_is_abs_section (p->sec->output_section))
+ if (! bfd_is_abs_section (sec_relocs->sec)
+ && bfd_is_abs_section (sec_relocs->sec->output_section))
{
/* Input section has been discarded, either because
it is a copy of a linkonce section or due to
linker script /DISCARD/, so we'll be discarding
the relocs too. */
}
- else if (p->count != 0)
+ else if (sec_relocs->count != 0)
{
- srel = elf_section_data (p->sec)->sreloc;
- srel->size += p->count * sizeof (Elf32_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+ srel = elf_section_data (sec_relocs->sec)->sreloc;
+ srel->size += sec_relocs->count
+ * sizeof (Elf32_External_Rela);
+ if ((sec_relocs->sec->output_section->flags & SEC_READONLY)
+ != 0)
info->flags |= DF_TEXTREL;
}
}
--
2.26.2
next prev parent reply other threads:[~2020-05-14 21:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 21:00 [OpenRISC] [PATCH 0/8] OpenRISC BFD fixups for Glibc Stafford Horne
2020-05-14 21:00 ` [OpenRISC] [PATCH 1/8] or1k: Fix static linking when with .rela.got relocations Stafford Horne
2020-05-14 21:00 ` [OpenRISC] [PATCH 2/8] or1k: Fix dynamic TLS symbol flag Stafford Horne
2020-05-14 21:00 ` [OpenRISC] [PATCH 3/8] or1k: Add TLS mask to handle multiple model access Stafford Horne
2020-05-14 21:00 ` [OpenRISC] [PATCH 4/8] or1k: Fix issue with multiple PCREL relocations Stafford Horne
2020-05-14 21:00 ` [OpenRISC] [PATCH 5/8] or1k: TLS offset to use tcb size and section alignment Stafford Horne
2020-05-14 21:00 ` Stafford Horne [this message]
2020-05-14 21:00 ` [OpenRISC] [PATCH 7/8] or1k: refactor: Rename s to sgot and splt Stafford Horne
2020-05-14 21:00 ` [OpenRISC] [PATCH 8/8] or1k: Add dynamic flag to tpoff Stafford Horne
2020-05-19 13:30 ` [OpenRISC] [PATCH 0/8] OpenRISC BFD fixups for Glibc Nick Clifton
2020-05-19 20:42 ` Stafford Horne
2020-05-20 10:41 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200514210018.2749462-7-shorne@gmail.com \
--to=shorne@gmail.com \
--cc=openrisc@lists.librecores.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox