aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-10-28 09:03:00 +1030
committerAlan Modra <amodra@gmail.com>2021-10-28 10:51:03 +1030
commit1cba418d26929e0fa0f9c43b2323093b1c7fa9de (patch)
tree1bbdbfa1b7032e356b45f0e4fd9d634fd59a627b /ld/ldlang.c
parent9fc9dbc28b4bd2363fb645f0b0260be8ba43fadf (diff)
downloadgdb-1cba418d26929e0fa0f9c43b2323093b1c7fa9de.zip
gdb-1cba418d26929e0fa0f9c43b2323093b1c7fa9de.tar.gz
gdb-1cba418d26929e0fa0f9c43b2323093b1c7fa9de.tar.bz2
ASSERT in empty output section with address
* ldlang.c (lang_do_assignments_1): Correct "dot" inside ignored sections. * testsuite/ld-scripts/empty-address-4.d, * testsuite/ld-scripts/empty-address-4.s, * testsuite/ld-scripts/empty-address-4.t: New test. * testsuite/ld-scripts/empty-address.exp: Run it.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index bc3f8b7..acd90fa 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6481,32 +6481,34 @@ lang_do_assignments_1 (lang_statement_union_type *s,
os = &(s->output_section_statement);
os->after_end = *found_end;
init_opb (os->bfd_section);
- if (os->bfd_section != NULL && !os->ignored)
+ newdot = dot;
+ if (os->bfd_section != NULL)
{
- if ((os->bfd_section->flags & SEC_ALLOC) != 0)
+ if (!os->ignored && (os->bfd_section->flags & SEC_ALLOC) != 0)
{
current_section = os;
prefer_next_section = false;
}
- dot = os->bfd_section->vma;
+ newdot = os->bfd_section->vma;
}
newdot = lang_do_assignments_1 (os->children.head,
- os, os->fill, dot, found_end);
+ os, os->fill, newdot, found_end);
if (!os->ignored)
{
if (os->bfd_section != NULL)
{
+ newdot = os->bfd_section->vma;
+
/* .tbss sections effectively have zero size. */
if (!IS_TBSS (os->bfd_section)
|| bfd_link_relocatable (&link_info))
- dot += TO_ADDR (os->bfd_section->size);
+ newdot += TO_ADDR (os->bfd_section->size);
if (os->update_dot_tree != NULL)
exp_fold_tree (os->update_dot_tree,
- bfd_abs_section_ptr, &dot);
+ bfd_abs_section_ptr, &newdot);
}
- else
- dot = newdot;
+ dot = newdot;
}
}
break;