summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2017-09-27 15:29:01 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2017-09-27 15:29:01 -0700
commite38654a24ed7ea91c1c199c21b52c4132cbe8d0e (patch)
treeff1501c778066e949b6e7ebffbf763cecf5007f9
parent94ead27971de001aea5b403130b2a94cf152ebd4 (diff)
downloadnasm-e38654a24ed7ea91c1c199c21b52c4132cbe8d0e.tar.gz
BR 3392411: smartalign: make sure we always define the end symbol
We need to always define the end symbol, otherwise we might find ourselves in a situation where the alignment code grows (common!) and then the symbol is defined late. Reported-by: ig <glucksmann@avast.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--macros/smartalign.mac4
-rw-r--r--test/br3392411.asm22
2 files changed, 24 insertions, 2 deletions
diff --git a/macros/smartalign.mac b/macros/smartalign.mac
index e5c0b99a..0f81ae87 100644
--- a/macros/smartalign.mac
+++ b/macros/smartalign.mac
@@ -1,6 +1,6 @@
;; --------------------------------------------------------------------------
;;
-;; Copyright 1996-2016 The NASM Authors - All Rights Reserved
+;; Copyright 1996-2017 The NASM Authors - All Rights Reserved
;; See the file AUTHORS included with the NASM distribution for
;; the specific copyright holders.
;;
@@ -173,7 +173,6 @@ USE: smartalign
jmp %$end
; We can't re-use %$pad here as $ will have changed!
times (((%1) - (($-$$) % (%1))) % (%1)) nop
-%$end:
%else
times (%$pad / __ALIGN_%[__BITS__]BIT_GROUP__) \
db __ALIGN_%[__BITS__]BIT_%[__ALIGN_%[__BITS__]BIT_GROUP__]B__
@@ -182,6 +181,7 @@ USE: smartalign
db __ALIGN_%[__BITS__]BIT_%[%$pad]B__
%endif
%endif
+%$end:
%pop
%endif
%endmacro
diff --git a/test/br3392411.asm b/test/br3392411.asm
new file mode 100644
index 00000000..02071a88
--- /dev/null
+++ b/test/br3392411.asm
@@ -0,0 +1,22 @@
+bits 64
+default rel
+
+%use smartalign
+
+section .text code align=32
+
+align 32
+
+nop
+jz LDone
+
+%rep 10
+ nop
+%endrep
+
+align 16
+%rep 115
+ nop
+%endrep
+
+LDone: