Age | Commit message (Collapse) | Author | Files | Lines |
|
When bnd prefix is dropped as jmp is encoded as jmp short,
nasm shows a warning message, which can be suppressed with a new
command line option, -w-bnd.
Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
|
|
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
There is no way to make it as a helper function
for a while, we need to unify list processing
in general (ie to use abstract list type).
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
No need to duplicate implementation.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
This reverts commit dd9c9752ead3a39fec6f050bfe3ac8768defc02f.
|
|
|
|
ARRAY_SIZE is a well known name pointing out that
we're dealing with array in macro argument.
Also to be on a safe side prefix_name helper should
check the index been in bounds more precisely.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Add ilog2_{32,64}() and alignlog2_{32,64}() ... the latter is intended
for alignment statements and return -1 for non-power-of-2 other than 0
(which returns 0).
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
|
For easier space separated words extraction
from a text stream.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Check if the offset and the representation are equivalent.
Disallow REL on absolute addresses.
I'm not sure what that would mean and the output formats don't support it.
Warn about ignored displacement size modifiers.
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
|
|
We will need it for hash tables
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
It's useful to protect our self from some
errors at build time.
For this sake we should use nasm_build_assert
if needed.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
This allow us to eliminate code duplication
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
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>
|
|
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>
|
|
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Convert tabs to spaces.
Eliminate empty comments.
No change on binary level.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Added a format attribute to nasm_error (only for GCC) and
used the resulting warnings to fix some format strings.
|
|
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
|
|
Remove a bunch of function pointers in the output stage; they are
never changed and don't add any value. Also make "ofile" a global
variable and let the backend use it directly.
All we ever did with these variables were stashing it in locals and
using them as-is anyway for no benefit.
Also change the global error function, nasm_error() into a true
function which invokes a function pointer internally. That lets us
use direct calls to it.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
*To the best of my knowledge*, we now have authorization from everyone
who has significantly contributed to NASM in the past. As such,
change the license to the 2-clause BSD license.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Change the "noreturn" macro to "no_return", to avoid problems with
system header files which use __attribute__((noreturn)) rather than
__attribute__((__noreturn__)) as is appropriate for system headers.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
We explicitly want the compiler to pessimize the taken case of the
assert, so unlikely() is appropriate here.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Add new nasm_assert() function, and add "const" to the declarations
which take filenames, as well as to the nasm_strdup/strndup functions.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Add copyright headers to the *.c/*.h files in the main directory. For
files where I'm sure enough that we have all the approvals, I have
given them the 2-BSD license, the others have been given the "LGPL for
now" license header. Most of them can probably be changed after
auditing.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Move the prototypes for the null debugging format to outform.h (for
the top-level structure declaration only) and outlib.h (for the
internal routines.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Make all the null debug routines available as a library, so we can use
them whenever appropriate. We really don't need to have a bunch of
dummy functions scattered all over the code.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
None of the strings passed to nasm_strcat() are modified, to
make them const.
|
|
We have a number of all-zero buffers in the code. Put a single
all-zero buffer in nasmlib.c. Additionally, add fwritezero()
which can be used to write an arbitrary number of all-zero bytes;
this prevents the situation where the all-zero buffer is simply
too small.
|
|
Issue better warnings for out-of-range values. This is not yet
complete.
In particular, note we may have out-of-range for values that end up
being subject to optimization. That is because the optimization takes
place on the *truncated* value, not the pre-truncated value.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Allow the user to suppress user-specified warnings.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
A few isolated instances of isalpha() and isxdigit().
|
|
ctype functions take an *int*, which the user is expected to have
taken the input character from getc() and friends, or taken a
character and cast it to (unsigned char).
We don't care about EOF (-1), so use macros that cast to (unsigned
char) for us.
|
|
On some platforms, tolower() is implemented as a function call, in
order to handle locale support. We never change locales, so can the
result of tolower() into a table, so we don't have to sit through the
function call every time.
~1.3% overall performance improvement on a macro-heavy benchmark under
Linux x86-64.
|
|
- Add %warning directive
- Only unquote an %error or %warning string if it is the only thing on
the directive line.
- Don't expand macros inside a quoted string, even for %error.
|
|
The RAA code doesn't have to be in nasmlib; it is only used by nasm
itself, and is better handled in a separate module.
|
|
Move all the SAA code out of nasmlib; it's not used by anything than
nasm itself. Cleaning out the kitchen sink known as nasmlib is a good
thing, too.
|
|
Hopefully backquoted strings should work correctly now.
|
|
First attempt at properly handle quoted strings in the preprocessor.
This also adds range support in %substr.
No support in the assembler yet.
|
|
When using temporaries in macros, given them a unique prefix to avoid
namespace collisions when using one macro inside another.
Move the WSAA*() macros from outelf32/outelf64 to a separate header
file.
|
|
1. Port dwarf3 support from ELF64 to ELF32
2. Move common SAA extentions to nasmlib
|
|
The OpenWatcom compiler warns about invalid shifts (correctly, it
appears) due to the non-X86_MEMORY versions of the various WRITE
macros. Fix.
|
|
Make the RAA size always a power of two, so we can use shifts instead
of multiple, expensive divides.
|
|
If we're doing logging, we need to call nasm_zalloc_log()
|