summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-04-21 01:15:28 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-04-21 01:15:28 +0400
commitc56a7a2c82508720bf9c758840e0bc356eb55aae (patch)
treeec0ff02f2963f4cf11958498b460e69e2f8e199b /output
parentf68feb08c2d67410693159f4de7346faabce0620 (diff)
downloadnasm-c56a7a2c82508720bf9c758840e0bc356eb55aae.tar.gz
Elf64: Implement segalign handler
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'output')
-rw-r--r--output/outelf64.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/output/outelf64.c b/output/outelf64.c
index 3ea96de7..c7baf4f5 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -1405,6 +1405,24 @@ static void elf_sect_writeaddr(struct Section *sect, int64_t data, size_t len)
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;
@@ -1501,7 +1519,7 @@ struct ofmt of_elf64 = {
elf_out,
elf_deflabel,
elf_section_names,
- null_segalign,
+ elf_segalign,
elf_segbase,
elf_directive,
elf_filename,