Commit Graph

4369 Commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
e7f4e0e229 test/Makefile: add .aout target
We had no target for generating an aout format file.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-18 11:24:29 -08:00
H. Peter Anvin (Intel)
e55d03dd47 Clean up the handling of various passes
The use of pass0, pass1, pass2, and "pass" passed as an argument is
really confusing and already caused a severe bug in the 2.14.01
release cycle. Clean them up and be far more explicit about what
various passes mean.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-18 11:14:59 -08:00
Cyrill Gorcunov
8c17bb2fc4 test: nasm-t -- Update tests
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-16 01:25:03 +03:00
Cyrill Gorcunov
35d047632b nasm: Fix condition in skip_this_pass
We should not match both condition.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-16 01:21:13 +03:00
Cyrill Gorcunov
988cc1222c asm/nasm.c: Drop tabs
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 23:44:46 +03:00
Cyrill Gorcunov
33b5d21fbd test: nasm-t -- Make read buffer up to 4M
Need to implement read on demand but later.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 22:56:18 +03:00
Cyrill Gorcunov
7d23d8d26f compier: Zap __builtin_constant_p on gcc 4.x series
It is been discovered that on gcc-4.8.4 compiler can't
properly evaluate __builtin_constant_p.

 | gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
 |
 | In file included from asm/nasm.c:38:0:
 | asm/nasm.c: In function ‘assemble_file’:
 | ./include/compiler.h:377:27: error: first argument to ‘__builtin_choose_expr’ not a constant
 |  # define if_constant(x,y) __builtin_choose_expr(is_constant(x),(x),(y))
 |                            ^
 | ./include/nasmlib.h:145:23: note: in expansion of macro ‘if_constant’
 |          static_assert(if_constant(x, 1), #x);                               \
 |                        ^
 | ./include/nasmlib.h:167:9: note: in expansion of macro ‘nasm_try_static_assert’
 |          nasm_try_static_assert(x);                              \
 |          ^
 | asm/nasm.c:1544:17: note: in expansion of macro ‘nasm_assert’
 |                  nasm_assert(output_ins.times >= 0);
 |

Zap it for 4.x series so we could run our tests.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 20:33:25 +03:00
Cyrill Gorcunov
6f33dbb087 build: aclocal.m4 -- Provide arguments to main
Which will allow to address these args inside test if needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 18:14:50 +03:00
Cyrill Gorcunov
dd83b26e57 nasmlib: Fix space/tabs mess
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 18:14:50 +03:00
Cyrill Gorcunov
3f11ddab41 compiler: Brace __builtin_constant_p argument
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 18:14:50 +03:00
Cyrill Gorcunov
82cc2fbef0 test: nasm-t -- Update multisection
We start printing [-w+other]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 15:39:56 +03:00
Cyrill Gorcunov
bbc0c01055 test: nasm-t -- Update riprel
We provide [-w+other] in output.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 15:39:56 +03:00
Cyrill Gorcunov
3999dcf2d4 test: nasm-t -- Update prefix66
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 15:39:56 +03:00
Cyrill Gorcunov
29fab74251 test: nasm-t -- Update multisection
Now we provide -w-other in output.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 15:39:56 +03:00
Cyrill Gorcunov
dbdc1a06c4 test: nasm-t -- Update mout
We start printing space after file name.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 15:39:56 +03:00
Cyrill Gorcunov
705472100a test: nasm-t -- Fix typo
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 15:39:51 +03:00
Cyrill Gorcunov
405556ff69 test: nasm-t -- Update floatb test
We start reporting overflow in float-points
which we previously missed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 12:31:56 +03:00
Cyrill Gorcunov
dfb164b73c test: nasm-t -- Update bcd test
We start printing [-w+other] in warning report.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 12:08:02 +03:00
Cyrill Gorcunov
e7da0b5455 test: nasm-t -- Reverse the comparision order
Comparing new and old data is inconvenient since
it rathe shows the reverse diff. Use straight
direction instead.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 12:02:37 +03:00
Cyrill Gorcunov
763cad619d test: nasm-t -- Move data reading out of cmp_std
Since the only purpose of cmp_std
is to compare outputs.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-15 12:00:16 +03:00
H. Peter Anvin (Intel)
b7f24e7715 nasm_assert(): try to run at compile time if possible
Try to make nasm_assert() do a static assert if the argument can be
evaluated at compile time by any particular compiler. We also provide
nasm_try_static_assert() which will assert a compile-time expression
if and only if we can determine we have a constant at compile time
*and* we know that the compiler has a way to handle it.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 15:42:03 -08:00
H. Peter Anvin (Intel)
c3c6cea838 warnings: make WARN_* constant obligatory for warnings
Make it an error to have ERR_WARNING without a suppression level.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 13:44:35 -08:00
H. Peter Anvin (Intel)
80c4f23c52 nasm_warnf() -> nasm_warn()
We want to strongly encourage writers of warnings to create warning
categories, so remove the flagless nasm_warn() and change nasm_warnf()
to nasm_warn().

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 13:33:24 -08:00
H. Peter Anvin (Intel)
727c85263f Merge tag 'nasm-2.14.01rc5'
NASM 2.14.01rc5

Resolved Conflicts:
	asm/labels.c
	asm/nasm.c
	version
2018-12-14 13:24:19 -08:00
H. Peter Anvin (Intel)
bc7f5fd93c NASM 2.14.01rc5 2018-12-14 13:08:39 -08:00
H. Peter Anvin (Intel)
1e2358b17f Document the -Ov option, minor fix for gcc -Og
The -Ov option is useful but was undocumented.

Add an initialization to keep gcc from complaining at optimization
level -Og.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 13:02:39 -08:00
H. Peter Anvin (Intel)
0402a2d402 labels.c: redefine test should be passn, not pass0
Stupid thinko: lpass should be passn + 1, not pass0 + 1.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 13:01:39 -08:00
H. Peter Anvin (Intel)
800c168688 --no-line: new option to ignore %line directives
For debugging preprocessed code, it is useful to be able to ignore
%line directives rather than having to filter them out externally.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 12:22:11 -08:00
Cyrill Gorcunov
b79b72fc25 build: Add warnings to PERLREQ
Missed from 723ab481a6

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-14 13:08:45 +03:00
H. Peter Anvin (Intel)
9df075595e Restore the ability to have ? in identifiers, except ? itself
? in identifiers turns out to be used in the field even in non-TASM
mode. Resolve this by allowing it in an identifier still, but treat
'?' by itself the same as we would a keyword, meaning that it needs to
be separated from other identifier characters.

In other words:

	a ? b : c	; conditional expression
	a?b:c		; seg:off expression seg = a?b, off = c

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 00:57:05 -08:00
H. Peter Anvin (Intel)
ce19a52a34 Define and use offsetin() instead of offsetof()
New macro which defines the offset on an object rather than a
type. This macro, as far as I know, ought to be fully portable, unlike
the fallback version of offsetof().

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 00:27:59 -08:00
H. Peter Anvin (Intel)
374312cde4 strlist, warnings: improve strlist, buffer warnings until error
Make strlist_free() take a pointer to a pointer, so we can set it to
NULL.

Buffer warnings on a strlist until we either get an error or we are in
pass 2. Hopefully this should let us get rid of a lot of the ERR_PASS*
bullshit, which far too often causes messages to get lost.

asm/labels.c contains one example of a warning that cannot be made
correct with a specific pass number.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 00:17:13 -08:00
H. Peter Anvin (Intel)
c5593142f7 hashtbl: fix errors in hash_iterate() and hash_free()
Both of these functions were apparently subtly broken after the revamp
to the new interfaces.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 00:10:15 -08:00
H. Peter Anvin (Intel)
628c93f0dc listing: use a non-uniqizing strlist to buffer error messages
Generic code is a wonderful thing...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 23:06:05 -08:00
H. Peter Anvin (Intel)
6ddc62fbab strlist: make sure strlist_free() works for a non-uniqizing list too
We can't rely on hash_free_all() when using a non-uniqizing list.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 22:59:50 -08:00
H. Peter Anvin (Intel)
7dc5b23920 configure: make section garbage collect the default
Section garbage collect really is quite useful, and it makes managing
library source code management a little bit less stressful. It has
been used by the official builds for a while now, turn it on by
default.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 22:51:22 -08:00
H. Peter Anvin (Intel)
7bb13eac11 strlist: can be unique or not, add printf functions
Make it a selectable option at allocation time if a strlist should
contain only unique strings or not. If not, we omit the hash table and
strlist_find() will not do anything.

Add printf()-style functions to a strlist.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 22:48:14 -08:00
H. Peter Anvin (Intel)
be99ebd656 assemble.c: capitalize LOCK prefix
LOCK is a keyword and not a descriptive term here, capitalize it.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 22:12:37 -08:00
H. Peter Anvin (Intel)
4229317a5f Merge branch 'mkwarnings'
Resolved conflicts:
	asm/nasm.c

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 22:10:25 -08:00
H. Peter Anvin (Intel)
0fca7de45d Merge remote-tracking branch 'origin/nasm-2.14.xx' 2018-12-13 22:09:08 -08:00
H. Peter Anvin (Intel)
db72dc0684 asprintf: add "axprintf" functions that allocate extra storage
Add a set of variants on the asprintf functions, "axprintf", which
allocate extra storage for metadata at the head of the allocated
buffer.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 22:07:31 -08:00
H. Peter Anvin (Intel)
e3b4332643 asprintf: actually include asprintf.c
File missing from earcier checkin...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 21:56:41 -08:00
H. Peter Anvin (Intel)
723ab481a6 warnings: define warning classes at point of use
It is extremely desirable to allow the user fine-grained control of
warnings, but this has been complicated by the fact that a warning
class has had to be defined in no less than three places (error.h,
error.c, nasmdoc.src) before it can be used in source code. Instead,
use a script to define these via magic comments at the point of use.

This hopefully will encourage creating new classes as needed.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 21:53:31 -08:00
H. Peter Anvin (Intel)
190e846563 errors: correct message saying -w+error= ... is in use when it is not
Correct the test for when -w+error= is the correct thing to print.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 21:45:59 -08:00
H. Peter Anvin (Intel)
6bde2ed880 errors: change the severity parameter from "int" to "errflags"
Change the severity parameter to the error function from "int" to an
unsigned typedef, currently uint32_t.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 19:42:38 -08:00
H. Peter Anvin (Intel)
9f89eb38fc Merge remote-tracking branch 'origin/master' into mkwarnings 2018-12-13 19:18:49 -08:00
H. Peter Anvin (Intel)
26572c6e37 warnings: change WARN_MNP -> WARN_MACRO_PARAMS
This one got missed during constant name conversion. Make the
constants match the options.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 16:51:45 -08:00
H. Peter Anvin (Intel)
152aadef66 NASM 2.14.01rc4 2018-12-13 16:45:08 -08:00
H. Peter Anvin (Intel)
78e39ace4b errfile.c: add file missing from previous checkin
File was missing from checkin

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 16:44:35 -08:00
H. Peter Anvin (Intel)
df2195b6a9 Merge remote-tracking branch 'origin/nasm-2.14.xx'
Resolved Conflicts:
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/openwcom.mak
	asm/nasm.c
	nasmlib/alloc.c

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 16:43:43 -08:00