PR24786, wrong LMA if first section in overlay is empty
This stops the first overlay section being ignored when empty, losing its LMA assignment PR 24786 * ldlang.h (enum section_type): Add first_overlay_section. * ldlang.c (lang_add_section): Adjust switch statement. (map_input_to_output_sections): Likewise. (lang_size_sections_1): Always set last_os for first overlay section. (lang_leave_overlay): Set sectype to first_overlay_section.
This commit is contained in:
parent
0c951c25c6
commit
7b2438015c
@ -1,3 +1,12 @@
|
|||||||
|
2019-07-13 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR 24786
|
||||||
|
* ldlang.h (enum section_type): Add first_overlay_section.
|
||||||
|
* ldlang.c (lang_add_section): Adjust switch statement.
|
||||||
|
(map_input_to_output_sections): Likewise.
|
||||||
|
(lang_size_sections_1): Always set last_os for first overlay section.
|
||||||
|
(lang_leave_overlay): Set sectype to first_overlay_section.
|
||||||
|
|
||||||
2019-07-08 Alan Modra <amodra@gmail.com>
|
2019-07-08 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* testsuite/ld-powerpc/callstub-1.d: Pass -melf64ppc to ld.
|
* testsuite/ld-powerpc/callstub-1.d: Pass -melf64ppc to ld.
|
||||||
|
19
ld/ldlang.c
19
ld/ldlang.c
@ -2579,6 +2579,7 @@ lang_add_section (lang_statement_list_type *ptr,
|
|||||||
{
|
{
|
||||||
case normal_section:
|
case normal_section:
|
||||||
case overlay_section:
|
case overlay_section:
|
||||||
|
case first_overlay_section:
|
||||||
break;
|
break;
|
||||||
case noalloc_section:
|
case noalloc_section:
|
||||||
flags &= ~SEC_ALLOC;
|
flags &= ~SEC_ALLOC;
|
||||||
@ -3846,6 +3847,7 @@ map_input_to_output_sections
|
|||||||
{
|
{
|
||||||
case normal_section:
|
case normal_section:
|
||||||
case overlay_section:
|
case overlay_section:
|
||||||
|
case first_overlay_section:
|
||||||
break;
|
break;
|
||||||
case noalloc_section:
|
case noalloc_section:
|
||||||
flags = SEC_HAS_CONTENTS;
|
flags = SEC_HAS_CONTENTS;
|
||||||
@ -5493,13 +5495,14 @@ lang_size_sections_1
|
|||||||
important, if an orphan section is placed after an
|
important, if an orphan section is placed after an
|
||||||
otherwise empty output section that has an explicit lma
|
otherwise empty output section that has an explicit lma
|
||||||
set, we want that lma reflected in the orphans lma. */
|
set, we want that lma reflected in the orphans lma. */
|
||||||
if (!IGNORE_SECTION (os->bfd_section)
|
if (((!IGNORE_SECTION (os->bfd_section)
|
||||||
&& (os->bfd_section->size != 0
|
&& (os->bfd_section->size != 0
|
||||||
|| (r->last_os == NULL
|
|| (r->last_os == NULL
|
||||||
&& os->bfd_section->vma != os->bfd_section->lma)
|
&& os->bfd_section->vma != os->bfd_section->lma)
|
||||||
|| (r->last_os != NULL
|
|| (r->last_os != NULL
|
||||||
&& dot >= (r->last_os->output_section_statement
|
&& dot >= (r->last_os->output_section_statement
|
||||||
.bfd_section->vma)))
|
.bfd_section->vma))))
|
||||||
|
|| os->sectype == first_overlay_section)
|
||||||
&& os->lma_region == NULL
|
&& os->lma_region == NULL
|
||||||
&& !bfd_link_relocatable (&link_info))
|
&& !bfd_link_relocatable (&link_info))
|
||||||
r->last_os = s;
|
r->last_os = s;
|
||||||
@ -8292,7 +8295,7 @@ lang_leave_overlay (etree_type *lma_expr,
|
|||||||
if (l->next == 0)
|
if (l->next == 0)
|
||||||
{
|
{
|
||||||
l->os->load_base = lma_expr;
|
l->os->load_base = lma_expr;
|
||||||
l->os->sectype = normal_section;
|
l->os->sectype = first_overlay_section;
|
||||||
}
|
}
|
||||||
if (phdrs != NULL && l->os->phdrs == NULL)
|
if (phdrs != NULL && l->os->phdrs == NULL)
|
||||||
l->os->phdrs = phdrs;
|
l->os->phdrs = phdrs;
|
||||||
|
@ -116,6 +116,7 @@ typedef struct lang_output_statement_struct
|
|||||||
enum section_type
|
enum section_type
|
||||||
{
|
{
|
||||||
normal_section,
|
normal_section,
|
||||||
|
first_overlay_section,
|
||||||
overlay_section,
|
overlay_section,
|
||||||
noload_section,
|
noload_section,
|
||||||
noalloc_section
|
noalloc_section
|
||||||
|
Loading…
x
Reference in New Issue
Block a user