Commit Graph

194 Commits

Author SHA1 Message Date
Cyrill Gorcunov
0835915c1d iflag: Start using new instruction flags engine
Here we start using instruction flags generator.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 13:20:59 +04:00
Jin Kyu Song
9bb987d8e0 AVX-512: Change the data type for instruction flags
Increased the size of data type for instruction flags from 32bits to 64bits.
And a new type (iflags_t) is defined for better maintainability.

Bigger data type is needed because more instruction set types are coming
but there were not enough space for them. Since they are not bit masks,
only one instruction set is allowed for each instruction.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-28 09:37:21 +04:00
Cyrill Gorcunov
deb082d633 BR3392248: Update nasm -h output
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-20 20:37:17 +04:00
Cyrill Gorcunov
190232f013 nasm.c: Convert GET_CURR_OFFS/SET_CURR_OFFS to functions
In future better to not work with global variables but
rather pass arguments.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:35:04 +04:00
Cyrill Gorcunov
f187eb7788 nasm.c: Update year in header
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:25:33 +04:00
Cyrill Gorcunov
52405e3727 nasm.c: Tabs to spaces in emit_dependencies
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:25:04 +04:00
Cyrill Gorcunov
9f56369883 nasm.c: Tabs to spaces in main
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:24:11 +04:00
Cyrill Gorcunov
45aa118fdf nasm.c: Tabs to spaces in copy_filename
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:22:59 +04:00
Cyrill Gorcunov
f831645ed8 nasm.c: Tabs to spaces in copy_filename
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:22:27 +04:00
Cyrill Gorcunov
331fd7c8aa nasm.c: Tabs to spaces in process_arg
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:20:58 +04:00
Cyrill Gorcunov
f196451d66 nasm.c: Tabs to spaces in process_response_file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:14:06 +04:00
Cyrill Gorcunov
1476319ced nasm.c: Tabs to spaces in assemble_file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 12:13:09 +04:00
Cyrill Gorcunov
04dba65098 nasm.c: Tabs to spaces in nasm_verror_gnu
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:21:07 +04:00
Cyrill Gorcunov
22ad904341 nasm.c: Tabs to spaces in nasm_verror_common
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:20:26 +04:00
Cyrill Gorcunov
cdaae1a8e3 nasm.c: Tabs to spaces in define_macros_early
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-15 02:16:58 +04:00
H. Peter Anvin
5534099473 When generate dependency names internally, quote filenames
Quote filenames for Make when generated for filenames internally.
Only skip quoting when using the -MT option (rather than -MQ).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-09-09 17:09:00 -07:00
Cyrill Gorcunov
b5e8fec848 preproc: Move NOP preprocessor into separate file
No need to carry it in nasm.c, let it be more modular.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-05-07 11:34:27 +04:00
Cyrill Gorcunov
0b78bff510 preproc: Split get rid of global preproc methods
This will allow to hook on updated preprocessor
without breaking existing one.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-05-07 01:57:55 +04:00
Cyrill Gorcunov
5bc6d8e44d help: Print that -Ox is a default optimization level
Reported-by: Frank Kotler <fbkotler@myfairpoint.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-03-11 14:19:17 +04:00
H. Peter Anvin
5a24fdd547 Make the LOCK and HLE warnings suppressable.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-25 15:11:11 -08:00
H. Peter Anvin
442a05a897 nasm.c: Fix is_suppressed_warning()
The logic in is_suppressed_warning() was severely wrong, which would
cause a lot of legitimate warnings to be suppressed while some
warnings would be duplicated.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-24 21:50:53 -08:00
Cyrill Gorcunov
b574b074a7 Don't forget to setup warning levels on preprocessor phase
http://bugzilla.nasm.us/show_bug.cgi?id=3143109

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-12-05 01:56:40 +04:00
Cyrill Gorcunov
d64b8098be Drop tab/space mess from parse_cmdline
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-12-05 01:44:43 +04:00
Cyrill Gorcunov
3b8c2974a1 Use proper bracing on setting warnings in comman line parsing
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-12-05 01:39:04 +04:00
Cyrill Gorcunov
0e754dcafe Add WARN_IDX helper and ERR_WARN_TERM named constant
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-12-05 01:01:06 +04:00
Cyrill Gorcunov
ead8772590 Simplify is_suppressed_warning helper
The former is really hard to read.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-12-04 19:24:25 +04:00
Cyrill Gorcunov
f4941892b3 Drop unused 'arg' variable
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-07-17 13:55:25 +04:00
Cyrill Gorcunov
86b2ad05f8 preproc: Move Preproc type to preproc_ops structure
There is no need to hide this structure into a type.
The former preproc_ops is a way more descriptive.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-07-02 00:15:24 +04:00
Cyrill Gorcunov
9fde335005 nassm.c: Use evaluate for section alignment
This allow us to write the whole expressions
on section alignments, such as

	align 0xa+6

or whatever math. Should be a way more convenient
than hardnumbers scheme we had.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-06-25 12:05:51 +04:00
Cyrill Gorcunov
c1936da942 ofmt: Alias shortname must be used for __OUTPUT_FORMAT__ macro
__OUTPUT_FORMAT__ must consist of shortname of output format
or its alias, otherwise userspace ABI gets broken.

For example source code still can refer to __OUTPUT_FORMAT__=elf,
instead of __OUTPUT_FORMAT__=elf32.

BR3246990

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-04-06 18:32:15 +04:00
Cyrill Gorcunov
91a65ba2b7 BR3200749: Fix "use after close" file pointer
Cleanup routine might be called several times
so be ready for that.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-03-07 11:18:50 +03:00
H. Peter Anvin
ab5bd05d82 Revert "Improve process_ea and introduce -OL"
This reverts commit ac732cb6a5.

Resolved Conflicts:

	doc/nasmdoc.src

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-25 12:43:30 -07:00
Victor van den Elzen
ac732cb6a5 Improve process_ea and introduce -OL
Two fixes:
1. Optimization of [bx+0xFFFF] etc
   0xFFFF is an sbyte under 16-bit semantics,
   so make sure to check it right.

2. Don't optimize displacements in -O0
   Displacements that fit into an sbyte or
   can be removed should *not* be optimized in -O0.

   Implicit zero displacements are still optimized, e.g.:
   [eax] -> 0 bit displacement, [ebp] -> 8 bit displacement.
   However explicit displacements are not optimized:
   [eax+0] -> 32 bit displacement, [ebp+0] -> 32 bit displacement.

Because #2 breaks compatibility with 0.98,
I introduced a new optimization level: -OL, legacy.
2010-07-24 22:00:12 +02:00
H. Peter Anvin
31387b2d04 Make -Ox the default
Make -Ox the default; it's the optimization level expected by most
users, and it is clearly still causing confusion that it has to be
specified manually.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 18:30:18 -07:00
Cyrill Gorcunov
69ce75076c No need for \n at __OUTPUT_FORMAT__ macro end
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:16:57 +04:00
Cyrill Gorcunov
2ef5c27be7 Rename SEGALIGN to SECTALIGN
"sectalign" is preferred over "segalign"
since it operates over section attributes.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 18:09:54 +04:00
Cyrill Gorcunov
2a587ab1c9 ofmt: Implement null_segalign stubs
Set stubs for all targets

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 01:08:36 +04:00
Cyrill Gorcunov
d5f2aef30a Introduce SEGALIGN directive
No real handling yet though. Definition only.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 01:07:47 +04:00
Cyrill Gorcunov
66206e7bd8 nasm.c: Delete redundant goto
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 01:06:27 +04:00
H. Peter Anvin
a36a4f2f1d nasm.c: smarter handling of missing directives
If we get D_unknown, we definitely don't need to pass it to the
backend for analysis.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-07 16:54:56 -07:00
H. Peter Anvin
888964a880 Distinguish no directive present from unknown directive
Distinguish the case of no directive present (D_none) from the case of
an unknown specified directive (D_unknown).  This is reflected in
different error messages.

Furthermore, change the special case symbols to lower case in case we
ever have a directive called [none] or [unknown].

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-06 17:00:12 -07:00
Cyrill Gorcunov
d879900c5a nasm.c: Restore strings broken by indent
A number of strings are broken by nindent passed over the nasm.c.
Though the compiler doesn't care about this fact it's really
unpleasant to have a string split at "dot" symbol.

Lets restore it in a sake of readability.

(No change on binary level)

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-01-09 20:36:18 +03:00
Cyrill Gorcunov
416bd78bae nasm.c: Use copy_filename to set error message file
To prevent errname buffer overwrite we should
use copy_filename instead of strcpy.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-12-04 19:44:20 +03:00
Cyrill Gorcunov
917117ff69 stdscan: switch to stdscan_get/set routines
Instead of manipulating stdscan buffer pointer directly
we switch to a routine interface.

This allow us to unify stdscan access: ie caller should
"talk" to stdscan via stdscan_get/set routines.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:02:43 +03:00
H. Peter Anvin
ff800417a1 nasm: rename nasm_zap_spaces() to nasm_zap_spaces_fwd()
By analogy with nasm_zap_spaces_rev() have nasm_zap_spaces_fwd().  The
forward version isn't a super-common operation, and it might be
possible to think the reverse one is the "normal" version... therefore
we might as well be explicit.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-13 12:03:37 -07:00
Cyrill Gorcunov
d61debfc91 nasm.c: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:14 +04:00
Cyrill Gorcunov
bd416c6860 nasm.c: getkw -- use string helpers
This allow us to shrink code a bit and
make it easy to read.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:05 +04:00
H. Peter Anvin
8bec2c788f nasm.c: fix stack overrun in assemble_file
If [DEBUG id] has id longer then 80 symbols (well, 79 actually plus
EOS) then stack will be just overwritten.

Fix it with explicit check for identifier being too long.

Based on an initial version by Cyrill Gorcunov <gorcunov@gmail.com>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
2009-08-08 13:49:00 -07:00
H. Peter Anvin
f46c0d6733 nasm.c: consistently use the 'murrican spelling "optimize"
"Optimise" (and other -ise words) is en_GB, "optimize" (and other
"-ize" words) is en_US.  Stick to en_US since that is what we seens to
be using more already.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-31 08:03:32 -07:00
Cyrill Gorcunov
73b87c68b1 nasm.c -- update info on -O cmdline option
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-07-31 10:26:55 +04:00