Commit Graph

189 Commits

Author SHA1 Message Date
H. Peter Anvin
be2678cd31 nasm.c: clean up the handing of response files
Avoid using malloc/free (not nasm_malloc/nasm_free even) in the
processing of response files; move to separate function.
2008-01-21 16:23:59 -08:00
H. Peter Anvin
a2c486cd6b Remove debugging printf
Remove debugging printf which shouldn't ever have been checked in ;)
2008-01-13 11:46:04 -08:00
H. Peter Anvin
00835fec0e Sanitize the pass logic, and only issue PASS1 warnings on pass0 == 1
For PASS1 warnings, only do them when pass0 == 1.  The prior passes
are to be considered training passes.  This is a bit awkward if we
then hit an error, but it's better than n repeated warnings.
2008-01-08 23:03:57 -08:00
H. Peter Anvin
34ec300643 Remove magic "five pass minimum" - I'm pretty sure optimizer is fixed.
The five-pass-minimum was a hack for a bug which I think is identified
now.  Doesn't really change the fact that if you want the optimizer,
you probably want -Ox.
2008-01-08 22:31:20 -08:00
H. Peter Anvin
62cf415f49 Optimizer: force progression through final passes when hitting limit
We have a number of bug reports about things not working properly when
the optimizer is running out of passes.  I suspect the reason is
simply that we don't properly execute the final passes (pass0 = 1, 2)
when hitting the limit.  Make sure we advance pass0 the last few
times.
2008-01-08 22:29:21 -08:00
Beroset
095e6a2973 regularized spelling of license to match name of LICENSE file 2007-12-29 09:44:23 -05:00
H. Peter Anvin
70c0bf22a2 BR 1834731: Remove redundant error messages for no input file
Avoid redundant error messages:

./nasm
nasm: error: no input file specified
nasm: fatal: file `' is both input and output file
type `nasm -h' for help

... which is more than a wee bit confusing to the user.
2007-11-19 11:45:40 -08:00
H. Peter Anvin
dc24271fae BR 1091926: Bounds checking for command line parsing
Avoid failure if the command line has doctored arguments.
2007-11-18 11:55:10 -08:00
H. Peter Anvin
423e381dd7 Clean up the command-line parsing; make -w/-W match others
Clean up the command-line parsing and make -w/-W match the behaviour
of all the other options with regards to arguments.
2007-11-15 17:12:29 -08:00
H. Peter Anvin
c68ec01277 Enable a few warnings by default; clean up warning descriptions 2007-11-13 11:34:34 -08:00
H. Peter Anvin
b030c92fee Add gcc-style -W/-Wno- warning selections; -Wall; -Werror
Add gcc-style -Wxxx -Wno-xxx warning selection as an alternative to
-w+xxx/-w-xxx.

Add "all" as an alias for all (actual) warnings.

Add "error" to treat warnings as errors.
2007-11-13 11:31:15 -08:00
H. Peter Anvin
d1fb15c154 Address data is int64_t; simplify writing an address object
Address data is always int64_t even if the size itself is smaller;
this was broken on bigendian hosts (still need testing!)

Create simple "write sized object" macros.
2007-11-13 09:37:59 -08:00
Charles Crayne
5fbbc8c2e7 Upgrade RAA functions to hold 64-bit data. 2007-11-07 19:03:46 -08:00
H. Peter Anvin
7065309739 Formatting: kill off "stealth whitespace"
"Stealth whitespace" makes it harder to read diffs, and just generally
cause unwanted weirdness.  Do a source-wide pass to get rid of it.
2007-10-19 14:42:29 -07:00
Charles Crayne
192d5b5e9c Suppress a few signedness warnings 2007-10-18 19:02:42 -07:00
H. Peter Anvin
f6c9e65d4f Implement floating-point option control directive
New directive [FLOAT] with associated standard macros; allows the
setting to be saved and restored.
2007-10-16 14:40:27 -07:00
H. Peter Anvin
fab3a6c9de Floating-point warning fixes; fix round-to-overflow
Actually generate the appropriate floating-point warnings, and only
one per assembly, pretty please.

Correct the round-to-overflow condition; as written all numbers with a
positive exponent were considered overflows!
2007-10-16 11:48:07 -07:00
H. Peter Anvin
125c878e96 Handle rounding of denorms correctly; make fp overflow a warning
- Handle rounding of denorms correctly
- Make fp overflow a warning, not an error (produces Inf)
- Make fp warnings controllable
2007-10-16 11:32:58 -07:00
H. Peter Anvin
70055964fc Additional uses of bool and enum
Proper use of bool and enum makes code easier to debug.  Do more of
it.  In particular, we really should stomp out any residual uses of
magic constants that aren't enums or, in some cases, even #defines.
2007-10-11 00:05:57 -07:00
H. Peter Anvin
6867acc18e Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C
requires <stdbool.h> for this, in C++ it is an inherent type built
into the compiler.  Use those instead of the old macros; emulate with
a simple typedef enum if unavailable.
2007-10-10 14:58:45 -07:00
H. Peter Anvin
fd7dd11345 Create option -Ox to tell NASM to do unlimited passes
Add option -Ox to tell NASM to do as many passes as it needs, instead
of imposing a fixed number.
2007-10-10 14:06:59 -07:00
H. Peter Anvin
9d637df6da Rewrite the handling of SAA's to allow random access
SAA's were never intended to allow random access, but several backends
do random or semirandom access via saa_fread() and saa_fwrite()
anyway.  Rewrite the SAA system to allow for efficient random access.

On "label.pl 10000000" this improves performance by a factor of 12.
2007-10-04 13:42:56 -07:00
H. Peter Anvin
12e46510bc Change cloc_t to struct location, and reorder the members
Change cloc_t to struct location, and reorder the members so that it
should fit in 16 bytes instead of needing 8 bytes of extra padding on
64-bit machines.
2007-10-03 21:30:57 -07:00
H. Peter Anvin
bfc1712137 BR 1352920: change loc_t -> cloc_t
Change loc_t to cloc_t to avoid AIX conflict.
We really shouldn't use _t names at all; they are usually considered
platform types, but worry about that later.
2007-10-03 21:24:51 -07:00
H. Peter Anvin
0a98f6046d BR 1352920: Handle upper case %line 2007-10-03 21:22:16 -07:00
H. Peter Anvin
fe501957c0 Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)

Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
2007-10-02 21:53:51 -07:00
H. Peter Anvin
c147da0d28 Unspecified files are null strings, not null pointers
We use empty strings, not null pointers, for unspecified files, so
there is no need to compare them for nullness.
2007-10-01 11:28:32 -07:00
H. Peter Anvin
59ddd26aac Check for the most basic filename overlaps
Check for the most basic filename overlaps, in case we have the
opportunity to save the user from himself.
2007-10-01 11:26:31 -07:00
Charles Crayne
fcce07f171 modified: nasm.1 to add newer command line options
modified:   nasm.c to fully parse command line before redirecting stderr.
2007-09-30 22:15:36 -07:00
H. Peter Anvin
413fb900bf nasm option reshuffling, -E -> -Z
Old -E becomes -Z
New -E is alias for -e
Remove the obsolete -r option
2007-09-26 15:19:28 -07:00
H. Peter Anvin
97e15755f9 Fix BR 1445441: uninitialized use of "error_file" 2007-09-25 08:48:37 -07:00
H. Peter Anvin
37a321fbbe Implement the -MG option (SF RFE 1564264)
Implement the -MG option, to generate dependencies in the presence of
generated files.  In the end, we probably need to support the full
gamut of GCC-like dependency-generation options.
2007-09-24 13:41:58 -07:00
H. Peter Anvin
4408b6265c Add TY_OWORD for "DO" output 2007-09-22 21:29:41 -07:00
H. Peter Anvin
269700972c Disallow optimizing by less than 5 passes.
Disallow optimizing by less than 5 passes.  If the user requests 2-4
passes, run 5 passes anyway.
2007-09-22 18:20:49 -07:00
H. Peter Anvin
74cc5e569c Finishing touches on perfect hash tokenizer; actually turn the thing on
Finish the perfect hash tokenizer, and actually enable it.

Move stdscan() et al to a separate file, since it's not needed in any
of the clients of nasmlib other than nasm itself.

Run make alldeps.
2007-08-30 22:35:34 +00:00
H. Peter Anvin
62b24d7e2f Add [default] directive
Add the [default {abs|rel}] directive, and clean up directive parsing.
2007-08-29 16:38:05 +00:00
H. Peter Anvin
99c4ecd18f Implement REL/ABS modifiers
Implement "REL" and "ABS" modifiers for offsets in 64-bit mode.  This
replaces "rip+XXX" type addressing.  The infrastructure to set the default
mode is there, but there is nothing to throw the switch just yet.
2007-08-28 23:06:00 +00:00
H. Peter Anvin
5a640e1161 Clean up the existing operand flag definitions, and document 2007-05-29 23:57:12 +00:00
H. Peter Anvin
0db11e236b Handle "LOCK as REX.R" for MOV CRx; fix warning for invalid 64-bit regs
- MOV gpr,CRx or MOV CRx,gpr can access high control registers with a LOCK
  prefix; handle that in both the assembler and disassembler.
- Get a saner error message when trying to access high resources in
  non-64-bit mode.
2007-04-17 20:23:11 +00:00
Keith Kanios
c7ae18dba1 Placated unreferenced types. 2007-04-14 00:46:25 +00:00
Keith Kanios
93f2e9a5a1 c99 printf/fprintf compliance. 2007-04-14 00:10:59 +00:00
Keith Kanios
a6dfa78b78 Fixed distinction between char and int8_t data types. 2007-04-13 16:47:53 +00:00
H. Peter Anvin
038d861ede Remove obsolete types; add <inttypes.h> where needed; header fixes
- Remove obsolete types like "uint32"; use "uint32_t" consistently.
- Make sure we include <inttypes.h> where needed.
- Header file guards should be FOO_H or SUBDIR_FOO_H; _FOO_H infringes
  on the C implementation's namespace and should only be used when
  writing libc!
- Change a few "int8_t" back to "char" where appropriate.  There are
  a lot more places where that should be done, though.
- Clean up the check for getuid/getgid in rdoff/rdlar.h.
2007-04-12 16:54:50 +00:00
Keith Kanios
b7a89544d0 General push for x86-64 support, dubbed 0.99.00. 2007-04-12 02:40:54 +00:00
H. Peter Anvin
e2c80181b6 Apply Nindent to all .c and .h files 2005-01-15 22:15:51 +00:00
H. Peter Anvin
9d5a64f00f Consistent capitalization 2005-01-14 22:56:01 +00:00
Ed Beroset
83b2809a03 changed sprintf to more secure snprintf to prevent vulnerability to buffer
overflow exploits.
2004-12-15 17:10:25 +00:00
Stanislav Karchebny
0a76a9e690 Backed out another patch =) 2003-09-26 04:20:30 +00:00
Stanislav Karchebny
d52236c00e Revert erroneous macro added and modify __OUTPUT_FORMAT__ to a string const 2003-09-25 11:43:28 +00:00
H. Peter Anvin
bb88d011e3 If we don't specify -g, actually suppress debugging output 2003-09-10 23:34:23 +00:00
H. Peter Anvin
9173ab9961 Update documentation slightly; remove weird special-casing of -O2 and -O3 2003-08-29 19:25:46 +00:00
Michael K. Ter Louw
1d392362ef Allow leading whitespace on output format specific directives. 2003-08-15 22:25:53 +00:00
Frank Kotler
d352302111 apply dborca's patch - make the "-U" switch work - finally! 2003-06-14 12:12:26 +00:00
Frank Kotler
fac9abce80 Remove "malloc.h" from rdoff/symtab.c - BSD build problem? 2003-04-01 06:42:15 +00:00
H. Peter Anvin
10101f26bc Add support for the new instructions in Prescott 2003-02-24 23:22:45 +00:00
Ed Beroset
6e61d0d3dc corrected comment above the report_error_vc function 2002-06-11 03:29:36 +00:00
H. Peter Anvin
fc869bac3d Visual C++ error format needs <space>:<space> after the parentheses. 2002-06-10 00:41:41 +00:00
Ed Beroset
fa77101245 Addressed feature request 555987 (Visual Studio integration) by adding the
requisite command line switch (-X) to select the error reporting format.
2002-06-09 20:56:40 +00:00
H. Peter Anvin
af5bc55524 Fix for BR 561137 (gcc3 compilation issue.) 2002-06-07 06:02:14 +00:00
H. Peter Anvin
3ab8de6a14 Add the JMPE instruction. 2002-05-28 01:25:06 +00:00
H. Peter Anvin
14f4d04643 Undo accidental checkin of old code 2002-05-26 21:48:18 +00:00
Debbie Wiles
f1a3f94d45 Reversed a change in 1.27 that affects ABSOLUTE. 2002-05-26 21:08:39 +00:00
John Coffman
0efaec964e Move optimizer output from '-g' switch to '-Ov' switch 2002-05-26 19:20:08 +00:00
H. Peter Anvin
d0e365d523 Make "ABSOLUTE <label>" work again; code based on 0.97. 2002-05-26 18:19:19 +00:00
H. Peter Anvin
086c80d72b Make it an error to supply a non-constant expression to ABSOLUTE 2002-05-25 01:45:11 +00:00
H. Peter Anvin
769f2cf792 No C++ comments, please! 2002-05-22 20:23:14 +00:00
Debbie Wiles
8311d9f310 Fixed the ABSOLUTE LABEL problem 2002-05-22 19:50:30 +00:00
H. Peter Anvin
0a7a3b459c Change "const static" -> "static const" to keep gcc happy 2002-05-14 23:54:46 +00:00
H. Peter Anvin
310b3e165f Code cleanup fixes from Ed Beroset 2002-05-14 22:38:55 +00:00
H. Peter Anvin
ff7ccc00d8 Change NASMOPT to NASMENV 2002-05-06 19:41:57 +00:00
H. Peter Anvin
53ea605b4d Change the NASM environment variable to NASMOPT. 2002-05-04 04:11:00 +00:00
H. Peter Anvin
8ac364139a NASM 0.98.30 2002-04-30 21:09:12 +00:00
H. Peter Anvin
b1a0143a0d NASM 0.98.20 2002-04-30 21:05:35 +00:00
H. Peter Anvin
caa82a1e66 NASM 0.98.16 2002-04-30 21:03:11 +00:00
H. Peter Anvin
ce61607e11 NASM 0.98.14 2002-04-30 21:02:23 +00:00
H. Peter Anvin
788e6c10e1 NASM 0.98.12 2002-04-30 21:02:01 +00:00
H. Peter Anvin
4cf1748e68 NASM 0.98.11 2002-04-30 21:01:38 +00:00
H. Peter Anvin
734b188090 NASM 0.98.09 2002-04-30 21:01:08 +00:00
H. Peter Anvin
1cd0e2d5bf NASM 0.98.08 2002-04-30 21:00:33 +00:00
H. Peter Anvin
af535c16cf NASM 0.98.03 2002-04-30 20:59:21 +00:00
H. Peter Anvin
41bf8002b2 NASM 0.98 2002-04-30 20:58:18 +00:00
H. Peter Anvin
ef7468f4ec NASM 0.98p7 2002-04-30 20:57:59 +00:00
H. Peter Anvin
620515ab4e NASM 0.98p6 2002-04-30 20:57:38 +00:00
H. Peter Anvin
eba20a73f2 NASM 0.98p3 2002-04-30 20:53:55 +00:00
H. Peter Anvin
76690a12ad NASM 0.96 2002-04-30 20:52:49 +00:00
H. Peter Anvin
6768eb71d8 NASM 0.95 2002-04-30 20:52:26 +00:00
H. Peter Anvin
d7ed89eac9 NASM 0.94 2002-04-30 20:52:08 +00:00
H. Peter Anvin
ea8382740d NASM 0.93 2002-04-30 20:51:53 +00:00
H. Peter Anvin
ea6e34db64 NASM 0.91 2002-04-30 20:51:32 +00:00