Commit Graph

3826 Commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
18535fd48c preproc: add %(i)defid, fix %(i)deftok code mangling
The previous checkin really got the code for %(i)deftok messed up;
this is fixed.

Add %(i)defid which works like %(i)deftok, except that the string
being input is mangled in such a way that it always results in a valid
NASM identifier.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 22:56:10 -07:00
H. Peter Anvin (Intel)
8884fc60a2 preproc: make %(i)deftok a bit more flexible
Make %(i)deftok capable of handling more than one input string, and
allow unquoted strings, a.k.a. bare tokens.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 22:15:00 -07:00
H. Peter Anvin (Intel)
a227b43b8a nasmlib: add nasm_strappend()
nasm_strappend() is similar to nasm_strcat() for the case where the
first string isn't useful and should be freed.  Furthermore, one or
both of the arguments are allowed to be NULL.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 22:13:42 -07:00
H. Peter Anvin (Intel)
d2cdb72e88 quote: revert preprocessor behavior
Revert the preprocessor to the previous behavior (any non-NUL
character permitted); this allows us to make nasm_unquote_cstr()
reject any control character, too.

Do make nasm_unquote_pp() at least warn on an unterminated string.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 21:20:02 -07:00
H. Peter Anvin (Intel)
68e7e5dda0 asm/directiv.c: move "special" in with the other symdef variables
Handle the string pointer "special" just like the other symdef parsing
variables (mangled, sizestr).

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 21:11:42 -07:00
H. Peter Anvin (Intel)
7603a4ef23 asm/directiv.c: remove unnecessary call to nasm_skip_spaces()
We have just make sure nasm_skip_spaces() was called right above it.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 21:10:03 -07:00
H. Peter Anvin (Intel)
bc7c4aba2a labels: global/common/extern/static can now force the external name
Add an option to the global/common/extern/static directives to force
the external name to be used for a label.  The syntax is:

	GLOBAL symbol "external_name" ...

where "external_name" is any NASM quoted string without control
characters.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 21:04:11 -07:00
H. Peter Anvin (Intel)
b90d5c7761 quote: move nasm_unquote_cstr() to quote.c; disallow control characters
Move nasm_unquote_cstr() to quote.c so we can use it in other places.
Provide nasm_unquote_pp() as a minimal wrapper for the preprocessor
itself.

Disallow non-ASCII characters except tab in the output.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 21:04:02 -07:00
H. Peter Anvin (Intel)
d558598ebe doc: add a few more updates
In particular, document the new behavior of EXTERN, GLOBAL and COMMON.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 18:19:15 -07:00
H. Peter Anvin (Intel)
70c09f0aac insns.dat: V4F(N)MADDSS are .lig not .512
These instructions ignore vector length.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 18:06:40 -07:00
H. Peter Anvin
717d878314 NASM 2.14rc10 2018-06-25 17:24:10 -07:00
H. Peter Anvin
bac9023d1c insns.dat: fix the opcodes for the V4FNM* instructions
The two V4FNM* instructions had the wrong opcodes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 17:22:41 -07:00
H. Peter Anvin
01192c0c4e NASM 2.14rc9 2018-06-25 17:17:02 -07:00
H. Peter Anvin
cd26fccab4 asm: support the +n syntax for register sets
Support the +n syntax for multiple contiguous registers, and emit it
in the output from ndisasm as well.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 17:15:08 -07:00
H. Peter Anvin (Intel)
2bf35e0b02 insns.dat: add support for the V4* and VP4* 4-way instructions
New instructions which do four full iterations of a data-reduction
operation (FMA, dot product.)

Bug report: https://bugzilla.nasm.us/show_bug.cgi?id=3392492

Reported-by: ff_ff <qqqqqqqqqfffffffff@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:51:15 -07:00
H. Peter Anvin (Intel)
26b810176f insns.dat: add PTWRITE instruction
Add PTWRITE instruction.  It is worth noting that we should
be able to do "ptwrite [eax]" in 32-bit mode, but the instruction
selector doesn't currently handle that well in a way that doesn't make
64-bit mode very confusing.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:35:05 -07:00
H. Peter Anvin (Intel)
b6b4b5d546 changes.src: cleanup and fixes
Clean up the language somewhat, and fix a couple of confusing
statements.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:19:39 -07:00
Chang S. Bae
ef21926ec2 doc: 2.14 change log
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:15:10 -07:00
Chang S. Bae
754edd85ee doc: document new feature from version 2.14
Added descriptions about new commandline options, STATIC
directive, symbol mingling, and some output format
specifics.

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:15:04 -07:00
Chang S. Bae
1af6ef4e14 nasm: fix some typo and description for the option help
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:14:44 -07:00
H. Peter Anvin (Intel)
ff6faf6134 NASM 2.14rc8 2018-06-25 14:13:20 -07:00
H. Peter Anvin (Intel)
415b6b3df1 absolute: in absolute space, need to use absolute.segment
We can be in absolute space and still end up with segment-relative
references.  This is in fact the meaning of absolute.segment.  Make
sure we define the labels appropriately.

Reported-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 14:09:52 -07:00
H. Peter Anvin, Intel
6bc18f1978 test: make absolute.asm buildable even when not in binary mode
absolute.asm is useful even for other backends, so explicitly test to
see if ORG is possible for this format.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 13:24:51 -07:00
H. Peter Anvin, Intel
59242bd10a test: add test for context-local labels and extern label promotion
Add a simple test case for context-local (%$) labels not disturbing
the local variable namespace, and extern labels getting promoted to
global.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 13:19:32 -07:00
H. Peter Anvin, Intel
c5e45f6b70 labels: auto-promote EXTERN labels to GLOBAL if defined
If we define a label which was previously declared EXTERN, then
automatically treat is as GLOBAL.

Previously, we would fail to converge and loop forever, which is
obviously not what we want.  This is more user-friendly anyway.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 13:16:53 -07:00
H. Peter Anvin, Intel
4fb2acc0d3 labels: if we have overridden EXTERN, don't call define_label()
If we have overridden EXTERN, then we should not call define_label()
on it again.  Return a fail status from declare_label(), indicating
that the type declaration failed, but of course we don't print an
error message.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 13:11:01 -07:00
H. Peter Anvin, Intel
2139874de2 labels: fix formatting of warning message
Output was backwards...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 13:03:39 -07:00
H. Peter Anvin, Intel
87d9e626c3 nasm: need to call init_labels() before command line parsing
The prefix and suffix options call perm_alloc() in labels.c, which is
not available until init_labels() have run.  There is no reason not to
call init_labels() early.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-06-25 12:58:49 -07:00
H. Peter Anvin, Intel
bc77f9c587 labels: don't update the local variable base for *ANY* dot labels
..@ labels (macro-local) are NASM specials, although not "magic": they
are explicitly defined to not preturb the local label base name.
However, they return false for both islocal() and ismagic(), so we
need to add a new function containing the correct test for when the
local label base should be advanced.

Reported-by: <balducci@units.it>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Bae, Chang Seok <chang.seok.bae@intel.com>
2018-06-25 12:45:14 -07:00
H. Peter Anvin
5ce7d1e897 NASM 2.14rc7 2018-06-18 17:14:39 -07:00
H. Peter Anvin
2c57d0a5ca RAA: make pointer vs integer RAAs type safe
Use pseudo-types to make it impossible to confuse RAAs made of
integers and RAAs made of pointers.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 17:11:54 -07:00
H. Peter Anvin
a5992a4c41 outmacho: don't use raa_read() for pointer values
If we write pointers, we have to read pointers.  This unbreaks
non-64-bit bigendian systems.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 16:00:48 -07:00
H. Peter Anvin
a7c8e39686 labels: pass the mangled name to the backend for fixups
ofmt->symdef() always takes the mangled label name, make sure we
actually do the correct thing even for forward fixups.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 14:17:26 -07:00
H. Peter Anvin
84ca80abd7 NASM 2.14rc6 2018-06-18 14:04:40 -07:00
H. Peter Anvin
50bbafbffb Makefile.in: fix building RDOFF
Apparently it isn't just NMAKE which is sensitive to the ordering of
.SUFFIXES, it apparently applies just as well to Unix make.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 14:02:29 -07:00
H. Peter Anvin
5d8193367e MSVC: fix dependency generation and building RDOFF under MSVC
1. The mkdep.pl program didn't handle excluded dependencies correctly,
   causing it to error out due to config/config.h not existing.
2. NMAKE is sensitive to the order suffixes appear in .SUFFIXES,
   causing it to try to use the builtin rule .c.exe instead of
   .c.obj -> .obj.exe.
3. NMAKE doesn't handle the && operator between commands.
4. The !ifdef jungle around dependency generation was wrong.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 13:54:43 -07:00
H. Peter Anvin
ef4e5e209f .gitignore: add asm/directbl.h
asm/directbl.h was missing from .gitignore, making this generated file
show up as a file not checked in.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 11:38:47 -07:00
H. Peter Anvin
1bcc1e012a test: test for ELF symbol visibility
Add test for declaring ELF visibility.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 11:37:17 -07:00
H. Peter Anvin
f7be8b3253 pragma: define a hander for generic output (and debug) pragmas
There are cases where we may want to implement generic pragmas, while
still make them selective based on output and/or debug formats.
Initially, use this for the prefix/suffix options.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Chang Seok Bae <chang.seok.bae@intel.com>
2018-06-18 11:34:33 -07:00
H. Peter Anvin
41103ab431 test/Makefile: qualify the names of list files with output format
It is quite likely we may want to build the same input with multiple
output formats; make it so we don't lose the list file.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 11:30:48 -07:00
H. Peter Anvin
8eb3096f7a nasm.h: remove unused constants
Remove unused constants for prefix and suffix, long since obsolete.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 11:12:49 -07:00
H. Peter Anvin
fee097f724 NASM 2.14rc5 2018-06-16 00:16:12 -07:00
H. Peter Anvin
854730bf62 insns.dat: update with instructions from ISE 319433-034
Add instructions from the Intel Instruction Set Extensions and Future
Features Programming Reference, document 319433-034, May 2018.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-06-16 00:13:58 -07:00
H. Peter Anvin
79561027a0 Make limits 64 bits, add globallines limit to configurable limits
Make all limit counters 64 bits, in case someone really has a usage
for an insanely large program. The globallines limit was omitted, add
it to the list of configurable limits.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-06-15 17:57:15 -07:00
H. Peter Anvin
675618c5dd Makefile.in: remove duplicated $(ALL_CFLAGS)
We really don't need every C compiler flag repeated twice.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-06-15 17:41:46 -07:00
H. Peter Anvin
14a10935f7 Merge commit '7daa26f9ba3ca45813d16ce540564448c13b16fa' into nasm-2.14.xx
Merge in some warning workarounds/possible bugs discovered by a recent
gcc.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-06-15 17:25:57 -07:00
H. Peter Anvin
430d41ede8 NASM 2.14rc4 2018-06-14 20:01:22 -07:00
H. Peter Anvin
46c839a03d labels: allocation of a segment number counts as a change
If we allocate a new segment number, that has to cause
global_offset_changed to be incremented.  Thus, we should not update
lptr->defn.segment until that would ordinarily be done.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-14 20:00:07 -07:00
H. Peter Anvin
af5f918a92 Don't keep assigning segment numbers to EXTERN or COMMON
If a symbol is EXTERN or COMMON, then we should not keep assigning it
new segment numbers over and over. Instead, change the label code so
that it assignes a new segment value if and only if one has not been
assigned before.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-14 19:53:45 -07:00
H. Peter Anvin
58ab877402 NASM 2.14rc3 2018-06-14 17:16:05 -07:00