We need to always define the end symbol, otherwise we might find
ourselves in a situation where the alignment code grows (common!) and
then the symbol is defined late.
Reported-by: ig <glucksmann@avast.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Issue a diagnostic and don't panic for invalid TIMES values.
Reported-by: C. Masloch <pushbx@38.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
The DWARF spec specifies that the .debug_abbrev section always should
end with a null byte. Existing tools don't seem to care, but some
issue a warning, and it is invalid according to spec.
Reported-by: Darren Sylvain <sylvaindarren@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Support 16-character section names, and support the debug section
flag.
Reported-by: Andrey Timofeyev <timofeyev@bk.ru>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
For some output types, the bit size, globalbits, follow the section
(segment); make sure we actually update it!
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
When using the -MW option, enclose whitespace-containing filenames in
double quotes. There are probably quite a few other things we ought
to know how to do...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
We have to consider mode decorators when considering instruction
matching, otherwise we end up falling back to VEX encoding if it is
available, losing the decorator. See BR 3392421.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Allow NASM to generate Watcom-style Makefile dependencies, in addition
to the default POSIX-style Makefile dependencies.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>