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>
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.
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>
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>
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>
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>
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>
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>
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>