From d5f2aef30abcba734c51abdadf3255a6f4bd5be9 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 20 Apr 2010 15:33:45 +0400 Subject: [PATCH] Introduce SEGALIGN directive No real handling yet though. Definition only. Signed-off-by: Cyrill Gorcunov --- directives.dat | 1 + nasm.c | 14 +++++++++++++- standard.mac | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/directives.dat b/directives.dat index b08d387..fbcf666 100644 --- a/directives.dat +++ b/directives.dat @@ -48,6 +48,7 @@ list section segment warning +segalign ; --- Format-specific directives export ; outcoff, outobj diff --git a/nasm.c b/nasm.c index a1ff56c..afd9ea4 100644 --- a/nasm.c +++ b/nasm.c @@ -1232,7 +1232,19 @@ static void assemble_file(char *fname, StrList **depend_ptr) location.segment = seg; } break; - case D_EXTERN: /* [EXTERN label:special] */ + case D_SEGALIGN: /* [SEGALIGN n] */ + { + if (*value) { + int align = atoi(value); + if (!is_power2(align)) { + nasm_error(ERR_NONFATAL, + "segment alignment `%s' is not power of two", + value); + } + } + } + break; + case D_EXTERN: /* [EXTERN label:special] */ if (*value == '$') value++; /* skip initial $ if present */ if (pass0 == 2) { diff --git a/standard.mac b/standard.mac index a3e8eea..a7a52db 100644 --- a/standard.mac +++ b/standard.mac @@ -66,6 +66,10 @@ %define __SECT__ [segment %1] __SECT__ %endmacro +%imacro segalign 1+.nolist +%define __SECT__ [segalign %1] + __SECT__ +%endmacro %imacro absolute 1+.nolist %define __SECT__ [absolute %1] -- 2.7.4