sectalign: "sectalign on|off" should not affect an explicit directive

sectalign on|off is documented to only affect the align/alignb
directives, *not* an explicit sectalign directive. This is fairly
obviously the proper behavior, so make it work accordingly.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2019-01-11 13:24:36 -08:00
parent 52266ad424
commit d7450a6478

View File

@ -1,6 +1,6 @@
;; --------------------------------------------------------------------------
;;
;; Copyright 1996-2016 The NASM Authors - All Rights Reserved
;; Copyright 1996-2019 The NASM Authors - All Rights Reserved
;; See the file AUTHORS included with the NASM distribution for
;; the specific copyright holders.
;;
@ -68,17 +68,13 @@ STD: nasm
%endmacro
%define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
%imacro sectalign 1.nolist
%ifnum %1
%if __SECTALIGN_ALIGN_UPDATES_SECTION__ = 1
[sectalign %1]
%endif
%imacro sectalign 1+.nolist
%ifidni %1,off
%define __SECTALIGN_ALIGN_UPDATES_SECTION__ 0
%elifidni %1,on
%define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
%else
%ifidni %1,off
%define __SECTALIGN_ALIGN_UPDATES_SECTION__ 0
%elifidni %1,on
%define __SECTALIGN_ALIGN_UPDATES_SECTION__ 1
%endif
[sectalign %1]
%endif
%endmacro
@ -117,12 +113,16 @@ STD: nasm
%endmacro
%imacro align 1-2+.nolist nop
sectalign %1
%if __SECTALIGN_ALIGN_UPDATES_SECTION__
sectalign %1
%endif
times (((%1) - (($-$$) % (%1))) % (%1)) %2
%endmacro
%imacro alignb 1-2+.nolist
sectalign %1
%if __SECTALIGN_ALIGN_UPDATES_SECTION__
sectalign %1
%endif
%ifempty %2
resb (((%1) - (($-$$) % (%1))) % (%1))
%else