output: Allow OUT_ADDRESS with a negative size to mean signed relocation

This only matters for ELF64/ELFx32, at least for now.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
listing: handle negative (signed) address size values

The listing module also needs to know about this new convention.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
assemble: Emit signed relocations where appropriate

Emit signed relocations where we know they are necessary.  This is not
at all exhaustive; in particular we are missing this for a number of
8- and 16-bit cases, and probably others.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
test: Add a test for various 32- and 64-bit relocations

Test signedness in a couple of different contexts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
assemble: Only treat a displacement as signed if it is < asize

Only generate a signed relocation if the displacement size is less
than the address size.  This matters when involving address size
overrides.

It is technically impossible to do this one perfectly, because it is
never really knowable if the displacement offset is used as a base or
an index.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
assemble.c: Don't drop rex prefix from instruction itself

emit_rex is supposed to write REX prefix into output stream
if needed, but we happen to drop it off on a first write
which breaks REX required instructions if TIMES directive
is used.

For example the code like

	| times 4		movq	xmm11, xmm11

compiles into

	| 0000000000000000 <.text>:
	|   0:	f3 45 0f 7e db       	movq   %xmm11,%xmm11
	|   5:	f3 0f 7e db          	movq   %xmm3,%xmm3
	|   9:	f3 0f 7e db          	movq   %xmm3,%xmm3
	|   d:	f3 0f 7e db          	movq   %xmm3,%xmm3

instead of proper

	| 0000000000000000 <.text>:
	|   0:	f3 45 0f 7e db       	movq   %xmm11,%xmm11
	|   5:	f3 45 0f 7e db       	movq   %xmm11,%xmm11
	|   a:	f3 45 0f 7e db       	movq   %xmm11,%xmm11
	|   f:	f3 45 0f 7e db       	movq   %xmm11,%xmm11

http://bugzilla.nasm.us/show_bug.cgi?id=3392278

Reported-by: Javier <elpochodelagente@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
changes: Document TIMES bug

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
NASM 2.11.03
AVX512: Remove invalid error checking

An offset-only memref can also have an opmask decorator.
e.g.) vmovdqu32 [0xabcd]{k1}, zmm0

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
ndisasm: Match vector length with EVEX.b set

With broadcasting, EVEX.L'L should be matched even when EVEX.b is set.
Only in a case of embedded rounding, EVEX.L'L is ignored in matching
function since it becomes EVEX.RC.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
changes: Document bug fixes

- Removed an error checking code for setting evex flags
- Fixed vector length matching bug

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Rename REX_REAL to REX_MASK

"Real" doesn't reflect the meaning of this
macro -- it rather represents a rex prefix mask.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
debug: Drop LOGALLOC usage

There are special tools (like valgrind and etc)
to track memory leaks, no need for own trivial
tracker.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
options: Add --v option

It's been requested a long ago to handle '--v' option same was as
a regualar '-v'. From initial report

 | NASM and yasm are in many respects compatible but yasm uses --v
 | instead of -v for version.  As often --v is used for version I
 | end up using --v initially in NASM.  This patch allows me to compile
 | Mozilla apps which use yasm with NASM by merely renaming NASM to yasm
 | so that the build environment does not have to be updated (Mozilla
 | would not accept changes to allow use of NASM).

Reported-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
NASM 2.11.04
options: Add --v option

It's been requested a long ago to handle '--v' option same was as
a regualar '-v'. From initial report

 | NASM and yasm are in many respects compatible but yasm uses --v
 | instead of -v for version.  As often --v is used for version I
 | end up using --v initially in NASM.  This patch allows me to compile
 | Mozilla apps which use yasm with NASM by merely renaming NASM to yasm
 | so that the build environment does not have to be updated (Mozilla
 | would not accept changes to allow use of NASM).

Reported-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Merge branch 'nasm-2.11.xx'
Merge remote-tracking branch 'origin/signrel'