Elf-32: Implement segalign handling

Via elf_segalign helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2010-04-21 01:05:13 +04:00
parent 2a587ab1c9
commit f68feb08c2

View File

@ -1305,6 +1305,24 @@ static void elf_sect_write(struct Section *sect,
sect->len += len;
}
static void elf_segalign(int32_t seg, int value)
{
struct Section *s = NULL;
int i;
for (i = 0; i < nsects; i++) {
if (sects[i]->index == seg) {
s = sects[i];
break;
}
}
if (!s || !is_power2(value))
return;
if ((unsigned int)value > s->align)
s->align = value;
}
static int32_t elf_segbase(int32_t segment)
{
return segment;
@ -1401,7 +1419,7 @@ struct ofmt of_elf32 = {
elf_out,
elf_deflabel,
elf_section_names,
null_segalign,
elf_segalign,
elf_segbase,
elf_directive,
elf_filename,