This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
lang_size_sections_1 cleanup
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 17 Mar 2010 19:06:47 +1030
- Subject: lang_size_sections_1 cleanup
I noticed the other day that the lang_constructors_statement recursive
call in lang_size_sections_1 passes a totally bogus value for "prev"
so set about fixing it, then decided that we don't need both "s" and
"prev" parameters either. As it happens the bogus argument would
never have been used, since constructor_list doesn't contain
input_section_statements.
* ldlang.c (lang_size_sections_1): Remove "s" param. Set "s" from
*prev instead. Update all callers.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.333
diff -u -p -r1.333 ldlang.c
--- ld/ldlang.c 16 Mar 2010 14:14:39 -0000 1.333
+++ ld/ldlang.c 17 Mar 2010 07:38:11 -0000
@@ -4680,16 +4680,17 @@ os_region_check (lang_output_section_sta
static bfd_vma
lang_size_sections_1
- (lang_statement_union_type *s,
+ (lang_statement_union_type **prev,
lang_output_section_statement_type *output_section_statement,
- lang_statement_union_type **prev,
fill_type *fill,
bfd_vma dot,
bfd_boolean *relax,
bfd_boolean check_regions)
{
+ lang_statement_union_type *s;
+
/* Size up the sections from their constituent parts. */
- for (; s != NULL; s = s->header.next)
+ for (s = *prev; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
@@ -4837,7 +4838,7 @@ lang_size_sections_1
os->bfd_section->output_offset = 0;
}
- lang_size_sections_1 (os->children.head, os, &os->children.head,
+ lang_size_sections_1 (&os->children.head, os,
os->fill, newdot, relax, check_regions);
os->processed_vma = TRUE;
@@ -4993,9 +4994,8 @@ lang_size_sections_1
break;
case lang_constructors_statement_enum:
- dot = lang_size_sections_1 (constructor_list.head,
+ dot = lang_size_sections_1 (&constructor_list.head,
output_section_statement,
- &s->wild_statement.children.head,
fill, dot, relax, check_regions);
break;
@@ -5052,9 +5052,8 @@ lang_size_sections_1
break;
case lang_wild_statement_enum:
- dot = lang_size_sections_1 (s->wild_statement.children.head,
+ dot = lang_size_sections_1 (&s->wild_statement.children.head,
output_section_statement,
- &s->wild_statement.children.head,
fill, dot, relax, check_regions);
break;
@@ -5071,7 +5070,7 @@ lang_size_sections_1
{
asection *i;
- i = (*prev)->input_section.section;
+ i = s->input_section.section;
if (relax)
{
bfd_boolean again;
@@ -5184,9 +5183,8 @@ lang_size_sections_1
break;
case lang_group_statement_enum:
- dot = lang_size_sections_1 (s->group_statement.children.head,
+ dot = lang_size_sections_1 (&s->group_statement.children.head,
output_section_statement,
- &s->group_statement.children.head,
fill, dot, relax, check_regions);
break;
@@ -5252,8 +5250,8 @@ void
one_lang_size_sections_pass (bfd_boolean *relax, bfd_boolean check_regions)
{
lang_statement_iteration++;
- lang_size_sections_1 (statement_list.head, abs_output_section,
- &statement_list.head, 0, 0, relax, check_regions);
+ lang_size_sections_1 (&statement_list.head, abs_output_section,
+ 0, 0, relax, check_regions);
}
void
--
Alan Modra
Australia Development Lab, IBM