mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
bin: Implement sectalign handler
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
279d8f146a
commit
630f221b01
@ -999,6 +999,27 @@ static int bin_read_attribute(char **line, int *attribute,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void bin_sectalign(int32_t seg, unsigned int value)
|
||||
{
|
||||
struct Section *s = find_section_by_index(seg);
|
||||
|
||||
if (!s || !is_power2(value))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Extended bin format non-default alignment
|
||||
* is forbidden
|
||||
*/
|
||||
if (!format_mode && (!strcmp(s->name, ".text")))
|
||||
return;
|
||||
|
||||
if (value > s->align)
|
||||
s->align = value;
|
||||
|
||||
if (!(s->flags & ALIGN_DEFINED))
|
||||
s->flags |= ALIGN_DEFINED;
|
||||
}
|
||||
|
||||
static void bin_assign_attributes(struct Section *sec, char *astring)
|
||||
{
|
||||
int attribute, check;
|
||||
@ -1672,7 +1693,7 @@ struct ofmt of_bin = {
|
||||
bin_out,
|
||||
bin_deflabel,
|
||||
bin_secname,
|
||||
null_sectalign,
|
||||
bin_sectalign,
|
||||
bin_segbase,
|
||||
bin_directive,
|
||||
bin_filename,
|
||||
@ -1691,7 +1712,7 @@ struct ofmt of_ith = {
|
||||
bin_out,
|
||||
bin_deflabel,
|
||||
bin_secname,
|
||||
null_sectalign,
|
||||
bin_sectalign,
|
||||
bin_segbase,
|
||||
bin_directive,
|
||||
ith_filename,
|
||||
@ -1710,7 +1731,7 @@ struct ofmt of_srec = {
|
||||
bin_out,
|
||||
bin_deflabel,
|
||||
bin_secname,
|
||||
null_sectalign,
|
||||
bin_sectalign,
|
||||
bin_segbase,
|
||||
bin_directive,
|
||||
srec_filename,
|
||||
|
Loading…
Reference in New Issue
Block a user