We already have abort-on-error memory allocation and I/O operations in
nasmlib, so use them for rdoff as well.
Delete long-since-obsolete rdoff Mkfiles directory.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
If $(X) is not empty, it needs to be added as a suffix, otherwise the
rule .$(O)$(X) won't do anything at all.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Fix a few dumb but serious mistables in Makefile.in that prevented
anything from actually getting linked.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The standard syntax for a phony target in Make is:
target: <dependencies>
.PHONY: target
... however, Watcom WMAKE seems to use
target: <dependencies> .SYMBOLIC
and furthermore, seems to *require* it. Therefore, remove the
"perlreq" target from the automatically distributed region and move it
into the specific region; it should not need to change anyway since
the PERLREQ list itself is still synced.
If it was only a matter of the .SYMBOLIC versus .PHONY token it would
be easy enough to change that in syncfiles.pl, but this syntax change
is big enough that it doesn't make enough sense to worry about.
Reported-by: sezero <sezero@users.sourceforge.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Distribute the file generation rules to auxiliary Makefiles via
syncfiles.pl. These rules are OS- and Make-dialect-generic enough
that our mangling script handles them well enough.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
insns-iflags.ph is included from another Perl script, so rename it .ph
(Perl header). Add missing dependency to the main Makefile.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add a generic facility for generating perfect string hashes, where all
that is needed is an enum and a string table. The existing mechanism
using a custom Perl script wrapped around a module continues to be
available for any use case where this particular approach isn't
sophisticated enough.
Much of this patch comes from renaming "enum directives" to "enum
directive" as a result of the string hash generator expecting a set of
uniform naming conventions.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Move directive processing to its own file, and move nasmlib/error.c to
asm/error.c (it was not used by the disassembler); remove some extern
declarations from .c files, and do some general code cleanups.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
We want to move the directive handling to a separate file, so change
the filename of the directive table handler to something a bit more
specific.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cleaning up hasn't really kept up to date with source code changes.
Try make it better for now; this also ought to make it easier to do
the corresponding cleaning in the *.mak files.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Most of the time we don't need the dumping code, so move it to a
separate C file to the linker can exclude it.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
There is no fundamental reason for all objects that don't contain a
main() function to not be part of libnasm.a; this allows the linker to
do its job optimally, especially in the presence of debugging code
which may not be needed under normal conditions.
If we do end up with function name conflicts the library might have to
be split, but it would be better to simply avoid that case.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Move memory-mapping functions from file.c into a separate mmap.c.
This will be cleaner especially once (if) we end up doing a Windows
implementation, which is likely to look entirely different.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Move the canned OpenWatcom configuration file to config/watcom.h.
Also exclude config/config.h from being a dependency for MSVC.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Sometimes we really want to use an extended pathname for an include
file, for documentation purposes; e.g. "config/config.h". This makes
alldeps handle that case correctly (and also adds the config/
directory to directories scanned by alldeps).
It is unclear if this will work correctly if there are include files
with the same name in different directories, but we currently do not
have any case like that.
Reported-by: anonymous coward <nasm64developer@users.sf.net>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make the source code easier to understand and keep track of by
organizing it into subdirectories depending on the function.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
nasmlib.c had basically turned into a garbage bin of various functions
with very little in common. Break it up into logical components for
isolation and manageability.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The code to handle building in a separate directory had seriously
bitrotted. This contains a number of fixes to make it possible,
including bits like the documentation which never worked in the past.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
The old code for keeping track of source file name and line was
confused as hell about ownership of the strings, and it is pretty
clear we leaked that information all over the place.
Instead, use a hash table to keep a copy of each string as necessary,
and simply make references to a string pool that we keep until the end
of the assembly session.
This pool probably should be unified with the list of dependency
files, and so on, but that is for the development branch.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
There is a bunch of common code here so merge them all into one file.
Unmergable parts are wrapped with is_elf() helpers.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Split lib/ into nasmlib/ (for nasm-specific functions) and stdlib/
(for replacements for C library functions which may be missing.)
Rename the ersatz inttypes.h to nasmint.h so we can use a simple test
in compiler.h instead of dealing with include path magic.
Remove tests in configure.in for ancient missing functions (which will
break the build anyway.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Move version strings to a separate header, instead of needing to
include nasm.h in places where it probably really doesn't belong.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
There is no reason to not use an archive manager to build our
executables. If there really are systems which don't have any kind of
archive manager, we can simply link all the objects.
This also drops any use of configure to detect library objects.
Instead just use HAVE_* and let the archive manager delete them.
A lot of additional functions could be declared library functions and
reorganized.
***FIX*** Mkfiles/*.mak have not yet been updated.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
nasmlib.[ch] desperately need to be broken up into smaller chunks.
Break file I/O related functions out into file.c, so at least we can
avoid the problem with P_WAIT being defined in <io.h> on Windows but
is also used as a prefix constant in "nasm.h".
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
For consistency with ofmt/dfmt, change the listing structure
to "struct lfmt" and "lfmt" and move it to listing.h.
From master branch commit 8ac25aa020
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make the NSIS output automatically select the output architecture to
generate the proper filename and, much more importantly, set up the
proper default install directory.
This requires Perl as well as makensis to be present in order to make
an installer, but that doesn't really seem like a too onerous of a
requirement (NSIS being the big external dependency here.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
For consistency with ofmt/dfmt, change the listing structure
to "struct lfmt" and "lfmt" and move it to listing.h.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>