Commit Graph

3246 Commits

Author SHA1 Message Date
H. Peter Anvin
da8659dfd0 Merge remote-tracking branch 'origin/nasm-2.12.xx'
Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-04 00:30:17 -07:00
H. Peter Anvin
ce63783e85 changes.src: typographical adjustment
Extremely minor typographical fix.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-04 00:04:44 -07:00
H. Peter Anvin
20a38e43e4 NASM 2.12.03rc1 2016-10-03 23:57:44 -07:00
H. Peter Anvin
6a6a40c268 changes.src: document CLWB and PCOMMIT
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-03 23:37:51 -07:00
H. Peter Anvin
9b630b4361 insns: add OBSOLETE flag for instructions removed from architecture
There aren't that many instructions which have been rmeoved from the
x86 architecture, but there is a handful.  Flag those with an OBSOLETE
flag.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-03 23:35:25 -07:00
H. Peter Anvin
a617487b50 Add the CLWB and (already deprecated) PCOMMIT instructions
Add the CLWB and PCOMMIT instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-03 23:23:02 -07:00
H. Peter Anvin
5e0d3b773f changes.src: update for a 2.12.03 release
We seem to have accumulated enough fixes that it ought to be time for
a 2.12.03 release.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-03 23:01:58 -07:00
H. Peter Anvin
e346b3b4a0 assemble: avoid redundant repetition in RESx warning message
Clean up the language in this warning message, so as not be so
unnecessarily repetitive.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-03 22:45:23 -07:00
H. Peter Anvin
c5d40b3576 assemble: print a warning on a forward reference in RESx
Print a warning on a forward reference in RESx.  This really should
have been a critical expression, and a forward reference should have
been an error, but it wasn't implemented that way and as such we can't
just randomly break people's code, even if it is dangerous.
2016-10-03 22:18:31 -07:00
H. Peter Anvin
55568c1193 nasm: scan the command line twice
Scan the command line twice, so we among other things can set up the
proper preprocessor before calling any of the preprocessor entry
points.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-03 19:46:49 -07:00
H. Peter Anvin
169ac7c152 Add a hash for pathname searches, instead of searching very pass
We have been doing a pathname search every time we encounter a file,
which means every file in every pass.  Instead, put the pathnames
found in a hash table.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-09-25 17:08:05 -07:00
H. Peter Anvin
96921a5ad8 backend: psas inslen == 0 to the backend for the INCBIN case
An INCBIN "instruction" can be enormous (up to an off_t size.)  There
is no reason to burden the rest of the code by widening the inslen and
insoffs fields just for INCBIN, so set inslen == 0 to indicate fields
not valid.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-09-24 09:53:03 -07:00
H. Peter Anvin
fa803abc61 backend: move wrapper for legacy output functions to a library routine
Move the wrapper for legacy output into a library routine so the
backends can be ported one at a time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-09-24 09:46:47 -07:00
H. Peter Anvin
04445364fc incbin: if we have to fread(), try to do it only once...
If we can't mmap a file and instead have to fread(), if the data is
small enough that we can reasonably accomodate it in a memory buffer,
then just read it once.

It seems rather unlikely that very large files would be used with
TIMES anyway.

Also note: the previous comment about nasm_file_size[_by_path]() being
invoked twice was spurious; it does not actually happen.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-21 15:56:19 -07:00
H. Peter Anvin
d81a235f33 file: improve the file access interface
A number of fairly common operations are invoked way too many times,
especially when using incbin.  Drastically reduce the number of system
calls that need to be executed, and use memory mapping to reduce
unnecessary double buffering.

We could improve this further by leaving files open once used;
however, that might run into file count problems on some systems.

Still unclear is why we seem to invoke nasm_file_size() twice per pass
for incbin.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-21 14:07:17 -07:00
H. Peter Anvin
c170089e7c nasmlib: move fseeko/ftello/off_t replacements to nasmlib.h
Move fseeko, ftello, and off_t definitions to nasmlib.h so that files
other than nasmlib/file.c can use them (already added to
asm/assemble.c).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-20 18:26:42 -07:00
H. Peter Anvin
e8b01c6f72 Merge remote-tracking branch 'origin/nasm-2.12.xx'
Bring the branches in sync.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

Resolved Conflicts:
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/netware.mak
	Mkfiles/openwcom.mak
	Mkfiles/owlinux.mak
	asm/assemble.c
2016-09-20 16:51:19 -07:00
H. Peter Anvin
637b9cc581 Correct /is4 encoding for EVEX instructions
For EVEX instructions, /is4 can contain a fifth register bit, encoded
in bit 3 of the imm8.  Properly generate this case, and simplifiy the
/is4 generation code somewhat.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

Cherry picked and ported from nasm-2.12.xx commit
976ba73062.

Resolved Conflicts:
	asm/assemble.c
2016-09-20 16:48:17 -07:00
H. Peter Anvin
976ba73062 Correct /is4 encoding for EVEX instructions
For EVEX instructions, /is4 can contain a fifth register bit, encoded
in bit 3 of the imm8.  Properly generate this case, and simplifiy the
/is4 generation code somewhat.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-20 16:39:46 -07:00
H. Peter Anvin
a77692b34d New backend interface - assembler internals #1
This provides the first pass of assembler internals for a new, richer,
backend interface.  It also reduces the amount of data carried in
function parameters inside the assembler.

The new interface is in the form of a structure, which will contain
substantially more information that the previous interface.  This will
allow things like ELF GOT32X and Mach-O X86_64_RELOC_BRANCH
relocations to be reliably emitted.

This provides the initial set of structures.  Future additions should
include:

1. Pass down the base symbol, if any.
2. Segments should be a structure rather than a number, and the
   horrible hack of adding one for a segment reference should be
   removed (OUT_SEGMENT replaces it.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-20 16:05:09 -07:00
H. Peter Anvin
9938bb6333 outelf: add panic() for unknown output types
If we get an output type we don't know how to handle, do a panic()
rather than a compile-time error; this will be necessary in the short
time pending a change to the backend interface.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-20 14:00:56 -07:00
Andy Willis
3f546034f3 nasm: Add --version option
Alias for known -v shorthand.

Signed-off-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-09-13 00:02:21 +03:00
H. Peter Anvin
7a82ebe7bd disp8: make constant arrays in get_disp8N() static
The constant arrays in get_disp8N() should be static; otherwise the
compiler has to manifest them on the stack for every execution which
makes no sense at all.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-08-25 17:40:13 -07:00
Henrik Gramner
ae707bace4 insns.dat: Enable contracted forms for additional instructions
Improve consistency by allowing contracted forms for EVEX-encoded
instructions when it's allowed for similar VEX-encoded instructions.

Previously the behavior would change depending on the vector size or
the register number which could be somewhat confusing:

    vaddps xmm0, xmm1  ; ok
    vaddps ymm0, ymm1  ; ok
    vaddps zmm0, zmm1  ; error
    vaddps xmm0, xmm16 ; error

Also allow contracted forms for a few additional older AVX instructions
where it makes sense.

Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-08-25 17:22:40 -07:00
Henrik Gramner
4098f5655f insns.dat: Fix EVEX vpbroadcast(b|w), vpextr(b|w), and vpinsr(b|w)
Use the correct T1S compressed displacements.

https://bugzilla.nasm.us/show_bug.cgi?id=3392302
https://bugzilla.nasm.us/show_bug.cgi?id=3392314

Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-08-25 17:22:34 -07:00
Fabian Giesen
0cb6739ba4 output: elf -- Generate SHT_RELA relocs for elfx32/elf64 stabs
stabs is the default debug format and GNU gold dies with an assertion
failure when it encounters a SHT_REL section in an x64 ELF file.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-08-18 00:51:36 +03:00
Fabian Giesen
f47f451a85 output: elf -- Fix debug info.
df_dwarf and df_stabs were orphans of the elf32/64 merge; clean up.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-08-18 00:51:20 +03:00
Henrik Gramner
de1fb48c3a insns.dat: Enable contracted forms for additional instructions
Improve consistency by allowing contracted forms for EVEX-encoded
instructions when it's allowed for similar VEX-encoded instructions.

Previously the behavior would change depending on the vector size or
the register number which could be somewhat confusing:

    vaddps xmm0, xmm1  ; ok
    vaddps ymm0, ymm1  ; ok
    vaddps zmm0, zmm1  ; error
    vaddps xmm0, xmm16 ; error

Also allow contracted forms for a few additional older AVX instructions
where it makes sense.

Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-08-18 00:50:31 +03:00
Henrik Gramner
865c31c676 insns.dat: Fix EVEX vpbroadcast(b|w), vpextr(b|w), and vpinsr(b|w)
Use the correct T1S compressed displacements.

https://bugzilla.nasm.us/show_bug.cgi?id=3392302
https://bugzilla.nasm.us/show_bug.cgi?id=3392314

Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-08-18 00:50:14 +03:00
H. Peter Anvin
40fc4dcb39 Run make alldeps 2016-08-16 15:06:11 -07:00
H. Peter Anvin
6e01ea2bc6 Run make alldeps
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-08-16 14:48:54 -07:00
H. Peter Anvin
3ffe8525e6 mkdep.pl: don't scan files until we know all the paths
Consistently identify dependencies by their path, not by their
basename.  This avoids missing indirect dependencies.  Furthermore, we
cannot start scanning files until we know the paths of all potential
targets.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-08-16 14:47:19 -07:00
H. Peter Anvin
43e026277b configure.ac: disable common data to avoid problems with some linkers
Disable common data to:

a) discover problems with common data as quickly as possible (we
   should not use common data as some compilers may not handle it);
b) work around a problem with the OSX linker causing it to not find
   zero_buffer even though it is defined in nasmlib/zerobuf.c.

Reported-by: anonymous coward <nasm64developer@users.sf.net>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-08-02 09:28:22 -07:00
Cyrill Gorcunov
43bb293432 Merge branch 'nasm-2.12.xx'
* nasm-2.12.xx:
  codeview: Fix ill-formed "S_COMPILE2" record.
  rdoff: Add rdf2bin input dependency
  labels: Warn if new label created on pass two
  Add explicit void parameter to newmembuf() function declaration.
  compiler.h: always undefine __STRICT_ANSI__ for gcc

| Conflicts:
|	rdoff/Makefile.in

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-27 01:08:51 +03:00
Fabian Giesen
1df89ea039 codeview: Fix ill-formed "S_COMPILE2" record.
write_symbolinfo_properties didn't match the S_COMPILE2 record it's
supposed to be writing (the "compiler version" string was emitted
starting in the final "version" field); fix that.

Write version 8.0.50727; the Windows App Certification Kit (WACK)
checks compiler versions as given in app debug info and complains
when the toolchain is too old. 8.0.50727 is the lowest permitted
"MASM" version for WACK to be happy, so that's what we write.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-27 01:06:09 +03:00
Fabian Giesen
199f3d7354 rdoff: Add rdf2bin input dependency
On host platforms where $(LN_S) is cp, need to make sure to
link rdf2bin first.

Backport of 6d67dbfa95

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-27 01:03:45 +03:00
Fabian Giesen
bb0fa088fb codeview: Fix ill-formed "S_COMPILE2" record.
write_symbolinfo_properties didn't match the S_COMPILE2 record it's
supposed to be writing (the "compiler version" string was emitted
starting in the final "version" field); fix that.

Write version 8.0.50727; the Windows App Certification Kit (WACK)
checks compiler versions as given in app debug info and complains
when the toolchain is too old. 8.0.50727 is the lowest permitted
"MASM" version for WACK to be happy, so that's what we write.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-18 14:55:55 +03:00
Fabian Giesen
6823d01c82 Make "make clean" actually clean all object files.
Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-18 14:52:27 +03:00
Fabian Giesen
6d67dbfa95 rdoff: Add rdf2bin input dependency
On host platforms where $(LN_S) is cp, need to make sure to
link rdf2bin first.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-18 14:52:27 +03:00
Cyrill Gorcunov
5dfcab6bf9 labels: Warn if new label created on pass two
When symbols are created turing non-first pass we
should at least warn a user since it's a sign of
potential problem.

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

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-18 11:49:47 +03:00
bcallah@devio.us
065c34273c Add explicit void parameter to newmembuf() function declaration.
In rdoff/rdoff.c, the function declaration for newmembuf is written:
static memorybuf *newmembuf()
The attached diff adds an explicit void parameter.
It seems like it would be nicer with an explicit void parameter
especially since the -Werror build options seem to want to find such
things.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-07-14 14:15:41 -07:00
H. Peter Anvin
2fc232bd23 compiler.h: always undefine __STRICT_ANSI__ for gcc
It is not just DJGPP which has broken header files if __STRICT_ANSI__
is defined.  Cygwin has also been confirmed to have problems.  It
would be somewhat different if configure didn't still detect those
functions.

Undefine __STRICT_ANSI__ for all gcc platforms.  If this breaks then,
well, we'll have to really narrow down the problems.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-07-14 13:51:01 -07:00
H. Peter Anvin
7e70f4dbb3 Merge tag 'nasm-2.12.02'
NASM 2.12.02

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-07-14 13:47:51 -07:00
H. Peter Anvin
f7606613d0 Handle multiple standard macro sets sanely
The ordering of the macro sets ended up changing due to the recent
file reorganization.  Instead of forcing the order again, handle
multiple macro sets (rather than just two) in a coherent manner.

macros/macros.pl could use a cleanup of duplicated code, however.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-07-13 14:23:48 -07:00
H. Peter Anvin
f640b61d55 NASM 2.12.02 2016-07-06 13:22:32 -07:00
H. Peter Anvin
0fcb488df3 Don't suppress ERR_DEBUG messages from the list file
In some cases, debug messages in the list file can be enormously
powerful for finding problems.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-07-06 11:55:25 -07:00
H. Peter Anvin
3d74b091e9 doc: update location of insns.dat
insns.dat is now in the x86 directory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-07-06 11:02:14 -07:00
Cyrill Gorcunov
bbb7a1aad9 preproc: Fix accessing OOM address
In case if there is no environment variable present
we allocated empty string but when working with tokens
we test for second byte for special symbols, accessing
out of memory address (->text[1] for the reference).

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

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-06-19 12:15:24 +03:00
H. Peter Anvin
66d561f2d9 Merge tag 'nasm-2.12.02rc9'
NASM 2.12.02rc9

Resolved Conflicts:
	asm/preproc.c
	version

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-06-16 15:47:46 -07:00
H. Peter Anvin
41d8a17195 NASM 2.12.02rc9 2016-06-16 15:33:53 -07:00