Commit graph

3434 commits

Author SHA1 Message Date
H. Peter Anvin
dd26697412 Makefile.in: fix dumb mistakes
Fix a few dumb but serious mistables in Makefile.in that prevented
anything from actually getting linked.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 18:42:39 -07:00
H. Peter Anvin
d7642a4a26 msvc.mak: finally make work with shared rdoff rules
We can finally make the shared rdoff rules work.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-06 18:18:11 -07:00
H. Peter Anvin
f05413eb61 Makefile.in: make rules for rdoff only define dependencies
MSVC command-line syntax doesn't allow us to share these rules if
explicit.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 18:10:29 -07:00
H. Peter Anvin
070508a5ae Makefile.in: make rules for rdoff only define dependencies
MSVC command-line syntax doesn't allow us to share these rules if
explicit.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 18:08:43 -07:00
H. Peter Anvin
5d2e42e621 Merge branch 'master' of ssh://repo.or.cz/nasm 2017-04-06 17:25:35 -07:00
H. Peter Anvin
9a714c98a2 rdoff: move rdoff build into main Makefile to make it build on Windows
NSIS packages rdoff, and we really want to be able to build the full
NSIS package on an MSVC platform.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 17:24:03 -07:00
H. Peter Anvin
cb8094a954 nsis: error out if getpearch.pl can't figure out what we need
Error out instead of failing silently in getpearch.pl

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 17:14:10 -07:00
H. Peter Anvin
63f68f5ea3 Merge branch 'master' of ssh://repo.or.cz/nasm 2017-04-06 16:31:39 -07:00
H. Peter Anvin
79570527b3 nsis: newer versions of NSIS uses \ for paths even on Unix
It seems that we have to use \ for paths on native Windows, and it
works on Unix as well, so just change all the paths accordingly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 16:28:59 -07:00
H. Peter Anvin
c822585e77 getpearch.pl: the PE header offset may be > 255
The PE header offset field is not a byte; assume it is a long.  The
specification doesn't actually say...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-06 16:20:50 -07:00
H. Peter Anvin
913394d52f Merge branch 'master' of ssh://repo.or.cz/nasm 2017-04-06 15:57:21 -07:00
H. Peter Anvin
3118429089 Windows: clean up the handling of stat on Windows
[f]stat on Windows is messy: we need to use _stati64 for maximum
compatibility, but because there is a bunch of stuff wrapped in
macros, autoconf sometimes gets the wrong answers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 15:48:51 -07:00
H. Peter Anvin
0da1549b73 autoconf: fix handling of --enable/--disable options, WINE fix
AC_ARG_ENABLE() doesn't really work the way you expect: one argument
is called on *any* invocation.  Create simple helper wrappers to get
the effect we really want for boolean options.

Define WINELOADER=/dev/null to prevent autoconf from inadvertently
running Wine and think we are not cross-compiling even if we are.  It
is at the very best slow and buys us absolutely nothing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 15:48:45 -07:00
H. Peter Anvin
c01af0967e msvc: define no_return
The syntax for no_return on MSVC is "__declspec(noreturn) void".

Signed-off-by: H. Peter Anvin <h.peter.anvin@intel.com>
2017-04-06 13:51:32 -07:00
H. Peter Anvin
3646e7dde0 BR 3392399: float: get rid of bogus exponent calculation
It turns out that the calculation of "twopwr" in ieee_flconvert_bin()
was more complex than necessary, and wrong in the case of a pure
fraction.

Reported-by: Roel <roelsuidgeest@zonnet.nl>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-05 21:47:20 -07:00
H. Peter Anvin
90cc4154ae BR 3392397: WMAKE uses a nonstandard syntax for phony targets
The standard syntax for a phony target in Make is:

target: <dependencies>

.PHONY: target

... however, Watcom WMAKE seems to use

target: <dependencies> .SYMBOLIC

and furthermore, seems to *require* it.  Therefore, remove the
"perlreq" target from the automatically distributed region and move it
into the specific region; it should not need to change anyway since
the PERLREQ list itself is still synced.

If it was only a matter of the .SYMBOLIC versus .PHONY token it would
be easy enough to change that in syncfiles.pl, but this syntax change
is big enough that it doesn't make enough sense to worry about.

Reported-by: sezero <sezero@users.sourceforge.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-05 21:24:55 -07:00
H. Peter Anvin
675e7b7d79 MSVC compatibility: clean up the handling of _stati64/_fstati64
On Windows we need to use _stati64/_fstati64 in order to handle large
file sizes, but the handling was broken in the canned MSVC++
configuration.  Clean it up and fix it.

This addresses BR 3392398.

Reported-by: Nikolai Saoukh <nms@otdel-1.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-05 21:19:03 -07:00
Nikolai Saoukh
9546507861 BR 3392395: unbreak msvc.mak build due to a stray backslash
Extra backslash had eaten one innocent line, thus compiler flags
(ALL_CFLAGS) are gone.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-05 20:58:42 -07:00
H. Peter Anvin
6c48b42466 Mkfiles: harmonize how perl and (if available) makensis is run
Use the same macros to run Perl and makensis across all Makefiles.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 11:23:31 -07:00
H. Peter Anvin
14858d7343 Makefiles: distribute file generation rules via syncfiles.pl
Distribute the file generation rules to auxiliary Makefiles via
syncfiles.pl.  These rules are OS- and Make-dialect-generic enough
that our mangling script handles them well enough.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 11:13:29 -07:00
H. Peter Anvin
1ebc83bd41 Mkfiles: remove unsupported Mkfiles/netware.mak
If someone really, really care about building NASM for Netware(!)
anymore, then they probably can use the autoconf-driven build script.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 11:12:20 -07:00
H. Peter Anvin
2956abbbf9 syncfiles.pl: allow for multiple synced sections
Allow for multiple sections of Makefiles to be synchronized; the
intent is to use this to synchronize the Perl file generation rules.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 11:10:31 -07:00
H. Peter Anvin
526a6c7390 Rename insns-iflags.pl -> insns-iflags.ph, add missing dependency
insns-iflags.ph is included from another Perl script, so rename it .ph
(Perl header).  Add missing dependency to the main Makefile.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 10:33:12 -07:00
H. Peter Anvin
5253f58c36 Add generic perfect string hashes, use for directives
Add a generic facility for generating perfect string hashes, where all
that is needed is an enum and a string table.  The existing mechanism
using a custom Perl script wrapped around a module continues to be
available for any use case where this particular approach isn't
sophisticated enough.

Much of this patch comes from renaming "enum directives" to "enum
directive" as a result of the string hash generator expecting a set of
uniform naming conventions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 00:27:07 -07:00
H. Peter Anvin
b1a5b26477 doc/changes.src: document AVX-512 fixes, Perl version requirement
It has been time to move on to new versions of Perl for a long time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-02 19:45:35 -07:00
H. Peter Anvin
841d904f88 perl: change to the new, safer 3-operand form of open()
The 2-operand form was inherently unsafe.  Use the 3-operand form
instead, which guarantees that arbitrary filenames are supported.

This also means we can remove a few instances of sysopen() which was
used for exactly this reason, however, at least in theory sysopen()
isn't portable.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-02 19:36:41 -07:00
H. Peter Anvin
dd535a6d19 NASM 2.13rc10 2017-04-02 19:12:25 -07:00
H. Peter Anvin
aac01ff479 Always remove a stale list file
Remove the list file before running the first pass, so in case we
die before running pass 2 then there won't be a stale list file
sitting around.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-02 19:11:40 -07:00
H. Peter Anvin
8f62246560 Further improve error messages for confused decorators
Try to generate more sensible error messages for bogus combinations
of decorators.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-02 19:02:29 -07:00
H. Peter Anvin
8e37ff4ea1 BR3392392: fix broadcast decorators and improve error messages
Checkin c33d95fde9:
    BR 3392370: {z} decorator allowed on MOVDQ* memory operands

... inadvertently broke broadcast operations, which only apply to
memory operands and therefore were only handled in one of the two
brace-parser implementations.  Fix that.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-02 18:38:58 -07:00
H. Peter Anvin
e886c0e968 Change nasm_zero() to pass an object, not a pointer
Passing an object to nasm_zero() allows us to use it on arrays.
Otherwise the array will decay to a pointer and silently clear only
the first member of the array!

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 14:56:17 -07:00
H. Peter Anvin
1980abfb7a BR 3392363: clear the operands when making an artificial I_RESB
When we make an artificial RESB instructions (due to isolated
prefixes) we need to make sure there isn't any crap left in the
operands structure.  The easiest way to guarantee that is to force it
to zero.

Reported-by: Henrik <henrik@gramner.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 14:53:24 -07:00
H. Peter Anvin
c33d95fde9 BR 3392370: {z} decorator allowed on MOVDQ* memory operands
The spec says very clearly the {z} decorator is allowed on memory
operands for the MOVDQ* instructions.  Remove special cases from the
code to disallow this case, which had the unfortunate effect of
generating a very uninformative error message.

Reported-by: Agner <agner@agner.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 14:37:24 -07:00
sezero
2cd8bab66a Mkfiles: remove useless/broken owlinux.mak, update README for openwcom.mak
To build with OpenWatcom and a standard Unix/GNU Make, use the owcc
wrapper.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 14:01:26 -07:00
H. Peter Anvin
17df43c8f2 outdbg: add %pragma for maximum size of a raw data dump
A raw data dump can potentially be very large, especially when
incbin is used.  Allow a %pragma for setting the maximum dump
size (defaults to 128 bytes.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 12:03:57 -07:00
H. Peter Anvin
ac06133ed2 output: remove the completely unused set_info method
Every single backend has this method set to NULL.  It is also a
rather strange interface.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 11:41:16 -07:00
H. Peter Anvin
31a14699fb outdbg: update to dump new backend interface data
Update the debug output format to dump (most of) the information that
is available via the new backend format, as well as the legacy backend
format -- probably the only backend ever which will ever want both!

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-31 11:32:53 -07:00
H. Peter Anvin
60ada96294 NASM 2.13rc9 2017-03-28 16:15:06 -07:00
H. Peter Anvin
cac0b19977 nasm.c: get rid of private copy of bitness
There is no reason to keep a private copy of the value of
"globalbits", which needs to be kept in sync anyway.  With the move of
directive processing to a separate file, this variable wasn't kept up
to date, resulting in failures.

This resolves BR 3392390.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-28 16:12:30 -07:00
H. Peter Anvin
d9bc244f8a assemble.c: if a displacement is large enough, we may wrap
If a displacement is as large as the address size currently in use
(which is the norm except for 64-bit code), then we should use
OUT_WRAP rather than OUT_UNSIGNED; the sign doesn't matter at all.

This resolves BR 3392391.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-28 15:54:15 -07:00
H. Peter Anvin
37d01d1a89 changes.src: document no_dead_strip
Document Mach-O support for no_dead_strip.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-28 15:51:45 -07:00
H. Peter Anvin
002532d323 Document new Mach-O flags
Add documentation for recent Mach-O enhancements.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-28 15:36:26 -07:00
Cyrill Gorcunov
495b6352d8 output: elf,dwarf -- Fix lookup over existing files
We are missing @next access here so in result we
might allocate same name several times.

Reported-by: "Bae, Chang Seok" <chang.seok.bae@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-03-23 19:19:38 +03:00
H. Peter Anvin
e74fd4b7b8 outelf: claim %pragma elf as our namespace
We don't have any elf pragmas yet, but we want to be able to do
"%pragma elf" and have it work for any of the elf formats.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-14 18:58:35 -07:00
H. Peter Anvin
6e4ceb7ba1 Merge remote-tracking branch 'origin/master' 2017-03-14 18:48:21 -07:00
H. Peter Anvin
9f16cfde4c macho: implement do_dead_strip, make subsections_by_symbols a pragma
Implement the MachO do_dead_strip directive, which sets a flag on the
corresponding section.  This as well as subsections_by_symbols are
reimplemented as pragmas; if someone uses the predefined macro they
still get the expected behavior.

However, this allows someone to write:

%pragma macho subsections_by_symbols

... and have it ignored if compiling for, say, ELF.

Also, implement the following section attributes:

      zerofill, no_dead_strip, live_support, strip_static_syms

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-14 18:46:31 -07:00
H. Peter Anvin
b852d351f6 nasmlib.h: explicitly include <ctype.h>
There are macros in this file which depend on <ctype.h>, so treat them
that way.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-14 18:42:25 -07:00
H. Peter Anvin
785ffb95da labels: make lookup_labels and is_extern take a const char *
Whenever we can, we should constipate our arguments...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-14 18:41:25 -07:00
Cyrill Gorcunov
fa38564c49 output: elf -- Fix typo in ELF32_ST_INFO
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-03-12 11:40:52 +03:00
Cyrill Gorcunov
bcf0389481 elf: Drop code duplication in elf_section_header
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-03-12 11:37:41 +03:00