mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 04:49:54 +08:00
* elf32-spu.c (spu_elf_auto_overlay): Take into account section
alignment when packing sections into overlays.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2009-07-07 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elf32-spu.c (spu_elf_auto_overlay): Take into account section
|
||||||
|
alignment when packing sections into overlays.
|
||||||
|
|
||||||
2009-07-03 Cary Coutant <ccoutant@google.com>
|
2009-07-03 Cary Coutant <ccoutant@google.com>
|
||||||
|
|
||||||
* dwarf2.c (decode_line_info): Ignore DW_LNE_set_discriminator.
|
* dwarf2.c (decode_line_info): Ignore DW_LNE_set_discriminator.
|
||||||
|
@ -4364,12 +4364,12 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
|
|||||||
ovlynum = 0;
|
ovlynum = 0;
|
||||||
while (base < count)
|
while (base < count)
|
||||||
{
|
{
|
||||||
unsigned int size = 0;
|
unsigned int size = 0, rosize = 0, roalign = 0;
|
||||||
|
|
||||||
for (i = base; i < count; i++)
|
for (i = base; i < count; i++)
|
||||||
{
|
{
|
||||||
asection *sec;
|
asection *sec, *rosec;
|
||||||
unsigned int tmp;
|
unsigned int tmp, rotmp;
|
||||||
unsigned int num_stubs;
|
unsigned int num_stubs;
|
||||||
struct call_info *call, *pasty;
|
struct call_info *call, *pasty;
|
||||||
struct _spu_elf_section_data *sec_data;
|
struct _spu_elf_section_data *sec_data;
|
||||||
@ -4379,10 +4379,16 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
|
|||||||
/* See whether we can add this section to the current
|
/* See whether we can add this section to the current
|
||||||
overlay without overflowing our overlay buffer. */
|
overlay without overflowing our overlay buffer. */
|
||||||
sec = ovly_sections[2 * i];
|
sec = ovly_sections[2 * i];
|
||||||
tmp = size + sec->size;
|
tmp = align_power (size, sec->alignment_power) + sec->size;
|
||||||
if (ovly_sections[2 * i + 1])
|
rotmp = rosize;
|
||||||
tmp += ovly_sections[2 * i + 1]->size;
|
rosec = ovly_sections[2 * i + 1];
|
||||||
if (tmp > overlay_size)
|
if (rosec != NULL)
|
||||||
|
{
|
||||||
|
rotmp = align_power (rotmp, rosec->alignment_power) + rosec->size;
|
||||||
|
if (roalign < rosec->alignment_power)
|
||||||
|
roalign = rosec->alignment_power;
|
||||||
|
}
|
||||||
|
if (align_power (tmp, roalign) + rotmp > overlay_size)
|
||||||
break;
|
break;
|
||||||
if (sec->segment_mark)
|
if (sec->segment_mark)
|
||||||
{
|
{
|
||||||
@ -4392,15 +4398,22 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
|
|||||||
while (pasty != NULL)
|
while (pasty != NULL)
|
||||||
{
|
{
|
||||||
struct function_info *call_fun = pasty->fun;
|
struct function_info *call_fun = pasty->fun;
|
||||||
tmp += call_fun->sec->size;
|
tmp = (align_power (tmp, call_fun->sec->alignment_power)
|
||||||
|
+ call_fun->sec->size);
|
||||||
if (call_fun->rodata)
|
if (call_fun->rodata)
|
||||||
tmp += call_fun->rodata->size;
|
{
|
||||||
|
rotmp = (align_power (rotmp,
|
||||||
|
call_fun->rodata->alignment_power)
|
||||||
|
+ call_fun->rodata->size);
|
||||||
|
if (roalign < rosec->alignment_power)
|
||||||
|
roalign = rosec->alignment_power;
|
||||||
|
}
|
||||||
for (pasty = call_fun->call_list; pasty; pasty = pasty->next)
|
for (pasty = call_fun->call_list; pasty; pasty = pasty->next)
|
||||||
if (pasty->is_pasted)
|
if (pasty->is_pasted)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tmp > overlay_size)
|
if (align_power (tmp, roalign) + rotmp > overlay_size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* If we add this section, we might need new overlay call
|
/* If we add this section, we might need new overlay call
|
||||||
@ -4457,10 +4470,11 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
|
|||||||
if (htab->params->ovly_flavour == ovly_soft_icache
|
if (htab->params->ovly_flavour == ovly_soft_icache
|
||||||
&& num_stubs > htab->params->max_branch)
|
&& num_stubs > htab->params->max_branch)
|
||||||
break;
|
break;
|
||||||
if (tmp + num_stubs * ovl_stub_size (htab->params)
|
if (align_power (tmp, roalign) + rotmp
|
||||||
> overlay_size)
|
+ num_stubs * ovl_stub_size (htab->params) > overlay_size)
|
||||||
break;
|
break;
|
||||||
size = tmp;
|
size = tmp;
|
||||||
|
rosize = rotmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == base)
|
if (i == base)
|
||||||
|
Reference in New Issue
Block a user