Commit Graph

3421 Commits

Author SHA1 Message Date
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
Cyrill Gorcunov
660101a02e elf: Align members for file format defs
For readability sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-03-12 11:37:23 +03:00
Cyrill Gorcunov
37034f1cc8 elf: Add EI_ constants
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-03-12 11:37:15 +03:00
H. Peter Anvin
8753425472 asm/pragma.c: if the handler is NULL, treat it as DIRR_UNKNOWN
If the handler is NULL, then all pragmas are by definition unknown, so
treat them exactly as if we had received DIRR_UNKNOWN from the
handler.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-08 20:28:13 -08:00
H. Peter Anvin
d9493fa440 pragma: use the directives hash to look up directive names
Very few things have any desire to do its own string parsing, and the
directives hash is already a plain string-to-numbers O(1) hash.  The
namespace is small enough that even if it makes some switch statements
compile a bit larger there is no real reason to have separate hashes,
even if the actual code as opposed to the data structure was shared.

So, for right now, just throw them together in one big happy pot.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-08 20:10:46 -08:00
H. Peter Anvin
d49a3bf6db changes.src: some minor textual improvements
Document the new -Werror= options a little bit better.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-08 01:50:08 -08:00
H. Peter Anvin
024d0e0fd0 NASM 2.13rc8 2017-03-08 01:32:56 -08:00
H. Peter Anvin
ea33e83081 Run "make alldeps"
Missing dependencies strike again :(

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-08 01:31:10 -08:00
H. Peter Anvin
e345e3d640 Merge remote-tracking branch 'origin/master' 2017-03-08 01:30:20 -08:00
H. Peter Anvin
b2047cbb98 Make -Werror controllable on a per-warning-class basis
Make -Werror possible to control on a per-warning-class basis.  While
I was fixing up that code anyway, merge the handling of the -w, -W and
[warning] argument and directives.

Furthermore, make *all* warnings suppressible; any warning that isn't
categorized now belong to category "other".  However, for cleanliness
sake an "other" option does not get listed in the warning messages.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-08 01:26:40 -08:00
Cyrill Gorcunov
485413344b asm/pragma: Add missing "assemble.h" inclusion
| asm/pragma.c:131:6: error: no previous prototype for ‘process_pragma’ [-Werror=missing-prototypes]
| void process_pragma(char *str)
|      ^~~~~~~~~~~~~~

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-03-08 11:39:42 +03:00
H. Peter Anvin
38373e8f1c NASM 2.13rc7 2017-03-07 23:04:15 -08:00
H. Peter Anvin
7fcd9898f4 doc: document subsections_via_symbols
Document the subsections_via_symbols directive.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-07 23:03:11 -08:00
H. Peter Anvin
fc7c5c3967 outmacho.mac: fix typo in subsections_via_symbols
subsections_via_symbols is plural for both nouns.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-07 23:02:31 -08:00