Commit Graph

1896 Commits

Author SHA1 Message Date
Cyrill Gorcunov
f66ac7deb0 preproc.c: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:10 +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
Cyrill Gorcunov
c7e8f1bf6f nasmlib: introduce string helpers
To make code more compact we introduce the
following string helpers:

1) nasm_scip_spaces - skip leading spaces
2) nasm_skip_word - skip leading non-spaces
3) nasm_zap_spaces - zap leading spaces with zero
4) nasm_zap_spaces_rev - zap spaces in reverse order

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:42:01 +04:00
Cyrill Gorcunov
9ccabd2922 assemble.c: check constants for overflow
Lets check if a constant supplied to DB and etc
does not overflow storage size and emit warning
if needed.

[ Bug #2857628 http://sourceforge.net/tracker/?func=detail&aid=2857628&group_id=6208&atid=106208 ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:57 +04:00
Cyrill Gorcunov
4b67cc371e introduce "overflow" helpers
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:53 +04:00
Cyrill Gorcunov
8a6345ca47 assemble.c: use is_class helper
is_class does not checking flags "strictly". Which means
it may fail if type is specified to REGMEM and you check for
is_class(MEMORY, ...).

Anyway in current patch we check for REGISTER which doesn't
overlap and it is safe to use is_class here.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:49 +04:00
Cyrill Gorcunov
1985416b0b nasm.h: introduce is_class macro helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:45 +04:00
Cyrill Gorcunov
1f75420d61 use opflags_t type for operands
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:41 +04:00
Cyrill Gorcunov
1598a23ba3 style cleanup
Convert tabs to spaces.
Eliminate empty comments.

No change on binary level.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-13 19:41:37 +04:00
H. Peter Anvin
8d2c4edd22 assemble: when looking for a REGISTER operand, do an exclusive test
Do an "exclusive" test for a REGISTER operand when deciding to treat
sizes as wildcards.  "Exclusive" meaning don't just accept any class
that could be REGISTER, but something that is strictly a part of the
REGISTER class.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-06 09:58:40 -07:00
H. Peter Anvin
ff5d656929 assemble: treat register operands without size as wildcards
Register with no size are a bit special: we don't honor extrinsic
register sizes in the first place ("oword xmm1" gives a warning,
even), and they should match any xmmrm size.  As such, explicitly
handle sizeless register operands as a hard match, instead of relying
on the fuzzy-matching mechanism to handle them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-05 14:08:05 -07:00
Cyrill Gorcunov
8186a0061a nasm.nsi: use "delete recursively" specificator
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-27 16:00:06 +04:00
Cyrill Gorcunov
54c8ccb443 nsis.nsi: add VS8 rules file to install
Add "VS8 intergartion" section with appropriate
files to be installed on user request.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-26 11:21:20 +04:00
Cyrill Gorcunov
946debb627 doc/nasmdoc.src: NASMENV -- fixup backslashes
−i option (include file search directories) should
contain trailing slash.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-26 01:06:18 +04:00
Henry Tumblin
ac9aaeeff0 Visual Studio 2008 NASM integration
Add integration rules in order to use NASM
seamlessly in your VS2k8.

Signed-off-by: Henry Tumblin <htumblin@users.sourceforge.net>
Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-25 20:49:51 +04:00
Cyrill Gorcunov
81d07c127d nasm.nsi: fixup shortcut target on nasm manual
There is no "manual.pdf" but "nasmdoc.pdf" instead.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 23:33:11 +04:00
Cyrill Gorcunov
0c1bd06a6c nasm.nsi: fixup output name
Sigh... It should be PACKAGE_SHORT_NAME
rather then PRODUCT_SHORT_NAME.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 21:29:57 +04:00
Cyrill Gorcunov
587f10ec47 nasm.nsi: set compressor before MUI macros
MULTIUSER_MUI may set own compressor so we
need to set it earlies to success.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 21:14:32 +04:00
H. Peter Anvin
5f3bd5dbf0 misc/release: *.ico are binary files
Zip needs to know which files to treat as binary, so tell it *.ico are
binary files.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-09-23 09:54:10 -07:00
Cyrill Gorcunov
6bd3f0bd9c nasm.nsi: restore old output name and compressor
Othrewise build robot fails

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 20:43:34 +04:00
Cyrill Gorcunov
33dd6d94c3 nasm.nsi: do not define VERSION twice
VERSION is already defined in version.nsh
no need to define it araing otherwise nsis
compiler fails.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-23 17:45:01 +04:00
Cyrill Gorcunov
c29cdb961e substitute nasm.nsi with new nasm2.nsi
We always have "restore point" but such an action will
allow us to test new installer in more wide audience.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-21 23:15:55 +04:00
Cyrill Gorcunov
f551e82fdf nsis2: prepare for substitution
- We need to change slashes to direct ones
- Installer file should be postfixed with plain "-installer"
- Remove nasm.exe duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-21 23:13:48 +04:00
Cyrill Gorcunov
2726889ece New NSIS script
Lets start using new NSIS features like
Modern UI2, Multiuser install.

The file named nasm2.nsi by purpose -- we should
_not_ break existing functionality.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-14 23:17:03 +04:00
Cyrill Gorcunov
69c4f63c25 elf,stabs: stabs32/64_generate -- append ending token
This represent "end of compilation unit" token.
Since gcc does (almost) the same lets be on the
same side.

Though to be precise gcc puts offset which points
to the first byte right after the last instruction
issued but in fact string index is analyzed only
so we may safely write zero here (without relocation
as well).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-14 22:43:30 +04:00
Cyrill Gorcunov
28032a027c output/elfcommon.h: tab/space cleanup
No change on binary level

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-06 15:25:35 +04:00
Cyrill Gorcunov
7ea1ef1c84 output/outelf32.c: code style simplification
1) nasm_free is safe against NULL passed so call
   it without test

2) dwarf32_output: check for debug_immcall early
   and get out of procedure if success. This allow
   us to move code blocks left removing indents.

3) dwarf32_findfile and dwarf32_findsect: no need
   for 'else' when 'if' target is plain return.
   Move code blocks left removing indents.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-03 20:16:28 +04:00
Cyrill Gorcunov
6ae5903676 output/outelf32.c: tab-space cleanup
Together with a small style nitpicking.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-03 20:02:33 +04:00
Cyrill Gorcunov
82a440da6d output/elf64.h: tab-space cleanup
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-03 19:10:55 +04:00
Cyrill Gorcunov
c5e7878943 output/elf32.h: tab-space cleanup
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-03 19:06:04 +04:00
Cyrill Gorcunov
2cff224e4b output/outelf.h - tab-space cleanup
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-09-03 19:04:23 +04:00
Cyrill Gorcunov
3757524161 Use I_none opcode instead of hardcoded number
Consolidate I_none opcode to be used everywhere
instead of mix (-1,I_none).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-23 10:40:17 -07:00
Victor van den Elzen
0dd450c0ef Use fputs instead of fprintf for plain strings
LLVM's Clang warns about this. outieee.c had a real problem.
2009-08-13 15:07:59 +02:00
Victor van den Elzen
15bb233036 Fix some format strings for nasm_error
Added a format attribute to nasm_error (only for GCC) and
used the resulting warnings to fix some format strings.
2009-08-11 02:43:41 +02:00
Cyrill Gorcunov
5a49e7c578 output/dwarf.h: update dwarf constants
There is a hope we'll be supporting dwarf in full form in future. So
I've encoded the standard constants (though binutils uses some
additional codes).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-10 16:00:43 -07:00
H. Peter Anvin
eaa68f1c85 Add strlcpy() function
Add strlcpy() function and implementation, and use configure to detect
if strlcpy() is natively available on the system.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-10 15:59:34 -07:00
H. Peter Anvin
767750b666 output: change null_debug_routine to null_debug_directive
This is the null implementation of the function debug_directive.  For
some reason it ended up getting mangled as "null_debug_routine".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-09 13:04:13 -07:00
Cyrill Gorcunov
0a45cc8ce8 disasm.c: eatbyte -- use snprintf to prevent potential buffer overflow
At moment we can't overrun buffer even if we would like to
but better to stay on a safe side and use snprintf.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-09 10:30:48 -07:00
Cyrill Gorcunov
c9b2d2a8ec headers/c: strip off useless spaces
All other templates do not have them
so lets unify the approach.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-09 10:28:27 -07:00
Cyrill Gorcunov
23c6f213bd insns.pl: remove redundant empty line in enum opcode
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-08 14:00:47 -07: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
f903da144d Merge commit 'cyr/hpa-dat' 2009-08-07 09:16:47 -07:00
H. Peter Anvin
3815aa7783 Merge commit 'cyr/hpa-list' 2009-08-07 09:16:19 -07:00
Cyrill Gorcunov
509aa63b31 insns.dat -- convert FMA instructions
Convert FMA instructions to explicit sized ones.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-08-07 18:42:40 +04:00
Cyrill Gorcunov
e652f82798 insns.dat -- convert AVX instructions part2
Convert Intel AVX instructions to explisit size
format. Part 2.

Also CLMUL converted as well.

Btw, VPINSR was a bit broken since SB constraint
is not applied on all forms but requires 16,32,64
memory sizes too. Fixed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-08-07 18:41:52 +04:00
Cyrill Gorcunov
b2cad279d9 insns.dat -- convert AVX instructions part1
Convert Intel AVX instructions to explisit size
format. Part 1.

Also SAR instruction is touched as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-08-07 00:26:54 +04:00
H. Peter Anvin
a5547dcb74 doc: \ needs to be repeated except in \c-line context; daily snapshots
Fix case where \\ needs to be written as \\\\ in order to appear as a
double backslash.  Also add mention of release candidates and
snapshots.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-08-02 14:16:07 -07:00
Cyrill Gorcunov
6f742649fe output/outbin.c -- use list helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-08-01 23:52:25 +04: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
124a462cc2 nasm.1 -- update contents
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-07-31 14:30:33 +04:00