Commit Graph

3574 Commits

Author SHA1 Message Date
H. Peter Anvin
97fda4ce6e asm/preproc.c: use nasm_add_string_to_strlist()
Use nasm_add_string_to_strlist() to avoid a memory leak.
nasm_add_to_strlist() requires that the caller manages the string
being added or not.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 15:52:51 -07:00
H. Peter Anvin
cf53dfbac4 misc/omfdump.c: expand dDEPFILE COMENT records
Expand dDEPFILE COMENT records.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 15:23:01 -07:00
H. Peter Anvin
a771be85f4 outobj: emit file dependency information
Some OMF toolchain can make use of file dependency information
embedded in the object files.  As implemented here, we don't try to
absolutize the filenames, as that prevents moving around trees and is
OS-dependent.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 15:00:38 -07:00
Martin Storsjö
f283c8f5c2 preproc: Add found files to the list of dependencies even when cached
This fixes the dependency listings as generated with -MD (if
assembling runs in multiple passes).

https://bugzilla.nasm.us/show_bug.cgi?id=3392420

gorcunov@: add missing zero byte

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:40 -07:00
Cyrill Gorcunov
d7a5473368 configure: Add --enable-gdb option
When one needs to run nasm under GDB

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:25 -07:00
Cyrill Gorcunov
750048723e preproc: Free token's text if only it has been modified
https://bugzilla.nasm.us/show_bug.cgi?id=3392414

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:15 -07:00
Adam Majer
91e72409be preproc: Workaround a usage after free bug
In some circumstantes this free is incorrect resulting
in usage after-free. Workaround it by not freeing memory
here.

https://bugzilla.nasm.us/show_bug.cgi?id=3392414

gorcunov@:
 - slightly tuneup the comment

Signed-off-by: Adam Majer <amajer@suse.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:04 -07:00
Adam Majer
1a069438ef preproc: Only concat tok->text if we accounted for its size
https://bugzilla.nasm.us/show_bug.cgi?id=3392415

Signed-off-by: Adam Majer <amajer@suse.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:58:53 -07:00
H. Peter Anvin
24f7b5c3e4 timestamp: centralize handing of compilation timestamp
Do all the generation and conversion of the compiler timestamp in one
place and make it available to modules.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-02 18:37:54 -07:00
Cyrill Gorcunov
f7e39739c3 nasmlib/md5c: Fix typo in WORDS_LITTLEENDIAN
https://bugzilla.nasm.us/show_bug.cgi?id=3392416

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-06-25 19:33:14 -07:00
H. Peter Anvin
92a8326f0d test/Makefile: separate NASM and NASMDEP
Separate out the NASM and NASMDEP variables, in case one wants to
override the former.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-06-25 19:32:41 -07:00
H. Peter Anvin
df1eec0315 saa: fix typo: LITTEENDIAN -> LITTLEENDIAN
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-06-23 14:39:12 -07:00
H. Peter Anvin
58d2ab176f outmacho: always use symbol-relative relocations for MachO64
It seems that the MachO64 linker really doesn't like segment-relative
relocations under certain circumstances, so force relocations to be converted
to "external" (symbol-relative); error out if no symbol is available
(if this is a problem, we can consider inserting a synthetic symbol if
necessary.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-06-22 23:36:34 -07:00
H. Peter Anvin
1669cb04a5 outdbg: make the output for relative relocations more clear
Make the output for relative relocations more clear, so it can be
actually comprehended.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-06-22 23:00:38 -07:00
H. Peter Anvin
8a6903c43d test/reldef.asm: add some global symbols
Make some symbols global for more testing.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-06-22 18:39:52 -07:00
H. Peter Anvin
f61dd0fdbb reldef.asm: add more test cases for reference
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-06-22 18:32:49 -07:00
H. Peter Anvin
37b9be3402 reldef.asm: more comprehensive test
More testing of various relative operations.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-06-22 18:20:44 -07:00
sezeroz
2987e5d90e BR 3392409: idata_bytes() and resv_bytes() don't match their prototypes
https://bugzilla.nasm.us/show_bug.cgi?id=3392409

idata_bytes() and resv_bytes() don't match their prototypes in common.c
which leads to a build error with watcom.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-06-01 15:23:05 -07:00
H. Peter Anvin
4be9b5790d nasmdoc.css: add more space between columns and a column separator
The columns were rather crammed together; add more space around them
and add a column separator bar.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-02 13:09:49 -07:00
H. Peter Anvin
735883692d Document/update dependencies for the documentation
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-02 13:01:59 -07:00
H. Peter Anvin
13ff7f92ec NASM 2.13.01 2017-05-01 22:17:48 -07:00
H. Peter Anvin
7c99db15f0 insns.h: change ITEMPLATE_END to not warn on some compilers
The use of negative numbers for some fields in ITEMPLATE_END triggers
a nuisance warning at least with Sun CC.  There is no reason for it:
the only thing that matters in this template is I_none, so declare it
that way.

See BR 3392372.

Reported-by: <noloader@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 22:06:58 -07:00
H. Peter Anvin
4892f95bb5 doc/changes.src: update with the latest changes
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 21:16:21 -07:00
H. Peter Anvin
3e458a89d8 a) Fix handling of DZ/ZWORD; b) don't crash on TIMES JMP
a) Fix a number of missing instances of DZ and ZWORD.

b) NASM would crash if TIMES was used on an instruction which varies
   in size, e.g. JMP.  Fix this by moving the handling of TIMES at a
   higher level, so we generate the instruction "de novo" for each
   iteration.  The exception is INCBIN, so we can avoid reading the
   included file over and over.

c) When using the RESx instructions, just fold TIMES into the reserved
   space size; there is absolutely no point to iterate over it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 21:13:15 -07:00
H. Peter Anvin
5810c594c9 listing: fix base address for TIMES
A simpler, and actually correct fix for the listing address for
TIMES.  The listing interface is quite frankly insane, but it probably
is better to fix it in 2.14+ and not in the maintenance branch.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 19:51:09 -07:00
H. Peter Anvin
5f93c9597d Revert "asm/assemble.c: correct the listing address for TIMES"
This reverts commit 440ba7e13e.

The fix is wrong; it causes the listing file to *only* show <rept>,
without showing the first iteration.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 19:44:34 -07:00
H. Peter Anvin
3301ee8a9e doc/changes.src: document the changes to the 2.13 maint branch so far
Current changes scheduled for 2.13.01.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 15:41:30 -07:00
H. Peter Anvin
440ba7e13e asm/assemble.c: correct the listing address for TIMES
We need to set the listing offset before calling LIST_TIMES, but we
had already advanced data.offset by calling out().  Move the call to
lfmt->set_offset() and lfmt->uplevel() to the top and out of the loop;
there is no reason for it to be in the loop in the first place.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 15:39:15 -07:00
H. Peter Anvin
571592ea63 listing.c: show [ssss] for a segment instead of a bogus address
There is no point in showing a number of a relative segment, so just
show [ssss]; even if there is a possible segment offset it is
linker-dependent and output format dependent.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 15:32:37 -07:00
H. Peter Anvin
217e714e6b output/legacy.c: OUT_SEGMENT -> OUT_ADDRESS with a zero addend
The legacy output doesn't distinguish between segments and other
addresses, so we need to force the offset to zero before passing it
down to the output layer.

This addresses BR 3392406.

Reported-by: <rugxulo@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 15:10:47 -07:00
H. Peter Anvin
08e71e7dc4 test/Makefile: add a rule to run omfdump on an .obj file
omfdump is really useful while debugging obj output, so add an
explicit rule to generate omfdump output.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-05-01 15:09:44 -07:00
H. Peter Anvin
91ac58dc65 changes.src: we managed to implement a few %pragmas before 2.13...
Minor change to the release notes for 2.13: we did end up with a few
actually implemented %pragmas.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-29 13:34:19 -07:00
H. Peter Anvin
b84ac82249 NASM 2.13 2017-04-29 13:25:21 -07:00
H. Peter Anvin
65ce38a819 nasmlib/ilog2.c: force the shift in ROUND() to be an uint32_t
Some compilers apparently warn on 1 << w for w == 31; fix it by
explicitly making it UINT32_C(1).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-29 13:13:59 -07:00
H. Peter Anvin
0624296834 changes.src: definitely making 2.13 next
About to release 2.13 for real.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-29 13:13:59 -07:00
H. Peter Anvin
d6b9227565 NASM 2.13rc23 2017-04-27 20:04:34 -07:00
Chang S. Bae
375f452813 outmacho: fix dwarf line number information (debug_line section)
Create directory table in prologue and file name indicates index
of the table for its directory

Now bring back included file names

Signedoff-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-27 20:04:15 -07:00
Chang S. Bae
961d8670bf outmacho: add dir list
Separate dir info from the file list to align with dwarf format
in debug_line section

Signedoff-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-27 20:03:53 -07:00
H. Peter Anvin
0e37f02bad Mkfiles/README: add a blank line
Trivial formatting fix: add a blank line for readability.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-26 00:22:42 -07:00
H. Peter Anvin
4aa13c9e81 Makefile.in: better filter for Perl dependencies
Be a bit smarter about what to require and what to ignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-26 00:21:40 -07:00
H. Peter Anvin
752781f2af doc/pspdf.pl: fix spacing
Fix whitespace alignment, no functional change.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-26 00:16:57 -07:00
H. Peter Anvin
e6eb87edc4 win32, doc: fix PDF generation scripts for Windows
Win32::Registry is obsolete, we need to use Win32::TieRegistry on
current platforms.

GhostScript uses # rather than = on Windows, it seems.

Try to find GhostScript in the registry and add it to the PATH.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-26 00:05:12 -07:00
H. Peter Anvin
409da5b561 Windows portability: fix construct in findfont.ph, README update
Fix a construct in doc/findfont.ph which crashes Perl on Windows
unconditionally.

Improve the README for building the full package with MSVC.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-25 20:32:39 -07:00
H. Peter Anvin
35915aec7f NASM 2.13rc22 2017-04-25 13:19:49 -07:00
H. Peter Anvin
c26a7d4cbe nasmlib/path.c: a few more detection macros
Add a few more operating system detection macros, including BeOS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-25 13:18:36 -07:00
Chang S. Bae
1d73d14eb0 outmatch: fix file info and cleanup in dwarf generation
In debug info and line, only main source is showed up. Header files
will be laid out via TAG_subprogram

Included missing memory cleanups

Removed unnecessary null assertions

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-25 12:54:25 -07:00
Chang S. Bae
64dd380f1e nasmlib: include macro for Mach system and fix on filename extraction
Add __MACH__ as a Unix-like system (e.g. MacOS X defines __MACH__ but
no variant of __unix__.)

Fix a reversed test in first_filename_char().

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-25 12:53:52 -07:00
H. Peter Anvin
c6bbfaa70d doc: formatting consistency for %!
Consistent formatting for the %! environment variable reference.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-25 12:39:11 -07:00
H. Peter Anvin
3ddaa86ba2 doc: make the %! (environment variable) construct a little clearer
Make the %! construct a little more clear.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-24 14:21:43 -07:00
H. Peter Anvin
f268b97a8e doc: add (deprecated) to context fall-through lookup heading
Context fall-through lookup is deprecated, make it as clear as
possible.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-24 14:18:59 -07:00