summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-08-12 19:09:28 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-08-12 19:09:28 +0400
commit8cb43d3f6833fa404cd906497db8bbd7fbca7335 (patch)
tree0ef948df5f50771623101e426560f84375d19272
parent41b17b1e31d12c6efa4e5ab9852410e77cdcb953 (diff)
downloadnasm-8cb43d3f6833fa404cd906497db8bbd7fbca7335.tar.gz
sectalign: Implement on/off mode
And describe it in documentation. We've introduced sectalign in 2.09rc series and have to provide an ability to steer this feature. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--doc/nasmdoc.src27
-rw-r--r--standard.mac13
2 files changed, 30 insertions, 10 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index e7973293..d6771cf5 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -4099,26 +4099,35 @@ boundary, for example, is a waste of effort. Again, NASM does not
check that the section's alignment characteristics are sensible for
the use of \c{ALIGN} or \c{ALIGNB}.
+Both \c{ALIGN} and \c{ALIGNB} do call \c{SECTALIGN} macro implicitly.
+See \k{sectalign} for details.
+
See also the \c{smartalign} standard macro package, \k{pkg_smartalign}.
\S{sectalign} \i\c{SECTALIGN}: Section Alignment
The \c{SECTALIGN} macros provides a way to modify alignment attribute
-of output file section. Unlike the \c{align=} attribute allowed at section
-definition only the \c{SECTALIGN} macro may be used any time you need it.
+of output file section. Unlike the \c{align=} attribute (which is allowed
+at section definition only) the \c{SECTALIGN} macro may be used at any time.
-For example the statement
+For example the directive
-\c
\c SECTALIGN 16
-\c
-sets a section alignment requirement to 16 bytes. Note that once increased
-the section alignment can not be decreased, the magnitude can grow only.
+sets the section alignment requirements to 16 bytes. Once increased it can
+not be decreased, the magnitude may grow only.
+
+Note that \c{ALIGN} (see \k{align}) calls the \c{SECTALIGN} macro implicitly
+so the active section alignment requirements may be updated. This is by default
+behaviour, if for some reason you want the \c{ALIGN} do not call \c{SECTALIGN}
+at all use the directive
+
+\c SECTALIGN OFF
+
+It is still possible to turn in on again by
-It must be also noted that \c{SECTALIGN} gets called implicitly inside \c{ALIGN}
-handler and as result \c{ALIGN} may update section alignment.
+\c SECTALIGN ON
\C{macropkg} \i{Standard Macro Packages}
diff --git a/standard.mac b/standard.mac
index 0b798962..b2dff8d6 100644
--- a/standard.mac
+++ b/standard.mac
@@ -68,8 +68,19 @@
__SECT__
%endmacro
+%define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
%imacro sectalign 1.nolist
- [sectalign %1]
+ %ifnum %1
+ %if __SECTALIGN_ALIGN_UPDATES_SECTION__ = 1
+ [sectalign %1]
+ %endif
+ %else
+ %ifidni %1,off
+ %define __SECTALIGN_ALIGN_UPDATES_SECTION__ 0
+ %elifidni %1,on
+ %define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
+ %endif
+ %endif
%endmacro
%imacro absolute 1+.nolist