Commit graph

169 commits

Author SHA1 Message Date
H. Peter Anvin
436e367874 Factor out common string list handling code
Simplify the preprocessor code by factoring out the common string list
handling code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-04 01:12:28 -07:00
H. Peter Anvin
fa803abc61 backend: move wrapper for legacy output functions to a library routine
Move the wrapper for legacy output into a library routine so the
backends can be ported one at a time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-09-24 09:46:47 -07:00
H. Peter Anvin
6e01ea2bc6 Run make alldeps
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-08-16 14:48:54 -07:00
Fabian Giesen
6823d01c82 Make "make clean" actually clean all object files.
Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-18 14:52:27 +03:00
H. Peter Anvin
e1f985c167 Reorganize the source code into subdirectories
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>
2016-05-25 12:06:29 -07:00
H. Peter Anvin
22538e2b67 nasmlib: break up nasmlib.c into logical components
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>
2016-05-25 05:43:49 -07:00
H. Peter Anvin
a87c5e4c87 Merge remote-tracking branch 'origin/nasm-2.12.xx'
Resolved Conflicts:
	.gitignore
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/netware.mak
	Mkfiles/openwcom.mak
	Mkfiles/owlinux.mak
	preproc-nop.c
	preproc.c
	version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-05-16 21:27:33 -07:00
H. Peter Anvin
407166001c Fix building in a separate directory from the source code
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>
2016-05-16 20:30:09 -07:00
H. Peter Anvin
b06736ae7e Unbreak building in a separate object directory
Fix bitrot in building in a separate object directory.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-05-16 13:20:01 -07:00
H. Peter Anvin
274cda81f8 Use a hash to keep exactly one copy of each filename around
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>
2016-05-10 03:01:58 -07:00
Cyrill Gorcunov
4670887c4d out: Elf -- Merge Elf32, Elfx32 and Elf64 into single file
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>
2016-04-24 20:02:41 +03:00
H. Peter Anvin
89c1770e14 autoconf improvements: @SET_MAKE@, library extension
Minor autoconf corner cases.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-03-09 14:11:40 -08:00
H. Peter Anvin
3ef4f00d5a lib: split library into stdlib and nasmlib; header handling fixes
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>
2016-03-08 12:20:02 -08:00
H. Peter Anvin
2bc0ab38a2 Move version strings to a separate header
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>
2016-03-08 02:17:36 -08:00
H. Peter Anvin
cc147f79e4 Makefiles: use actual archive managers
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>
2016-03-08 02:08:44 -08:00
H. Peter Anvin
bdae10bee2 Move file I/O related functions out of nasmlib.c
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>
2016-03-08 01:22:13 -08:00
H. Peter Anvin
1917f45ec2 Merge remote-tracking branch 'origin/nasm-2.12.xx'
Resolved Conflicts:
	output/codeview.c
	output/outelf32.c
	output/outelf64.c
	output/outelfx32.c
	output/outform.c
	output/outform.h
	output/outieee.c
	output/outobj.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-03-08 01:08:53 -08:00
H. Peter Anvin
8da30d0266 Makefiles: run "make alldeps"
Automatic update of dependencies.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-03-07 23:23:19 -08:00
H. Peter Anvin
6224033738 Merge remote-tracking branch 'origin/nasm-2.12.xx'
Resolved Conflicts:
	.gitignore
	Makefile.in
	assemble.c
	configure.in
	eval.c
	float.c
	listing.c
	nasm.c
	nasmlib.c
	output/outform.h
	preproc.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-03-07 12:15:40 -08:00
H. Peter Anvin
172b840aa3 Change nasmlist/ListGen to lfmt/struct lfmt
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>
2016-03-07 12:08:48 -08:00
H. Peter Anvin
d4c67b1597 nsis: make nsis output automatically select architecture
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>
2016-03-03 21:37:37 -08:00
H. Peter Anvin
8ac25aa020 Change nasmlist/ListGen to lfmt/struct lfmt
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>
2016-02-18 01:16:18 -08:00
H. Peter Anvin
15a6aa7ade Makefile: remove explicit mention of lib/strlcpy.c
Don't inclure lib/strlcpy.c unconditionally, that is what
LIBOBJS is for.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 01:07:34 -08:00
H. Peter Anvin
d338b376df Portability improvements and autoconf modernization
Improve the portability of the code and modernize our use of
autoconf.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 01:03:51 -08:00
H. Peter Anvin
99276cc7d9 outmacho: rename outmac.c to outmacho.c
We already have outmacho.mac, so name this file outmacho.c.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-12 21:19:13 -08:00
H. Peter Anvin
c635497870 Merge the macho32 and macho64 (outmac32/64) backends
Merge the two Mach-O backends for cleanliness and maintainability.
This should also make the recent fixes to MachO-64 available in
MachO-32.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-12 03:04:41 -08:00
H. Peter Anvin
ad790a2e39 make alldeps to remove unnecessary dependencies for realpath.c
The previous commit contained unnecessary dependencies for realpath.c
so run make alldeps to remove those.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-01-26 12:07:58 -08:00
H. Peter Anvin
4627e695a5 Portability improvements to nasm_realpath()
Try harder to nasm_realpath() to be as portable as possible.  Move it
to a separate file since it has gotten complex enough that it is
cleaner that way.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-01-26 12:01:34 -08:00
Jim Kukunas
3115e789d6 coff: Add support for the Codeview 8 debug format
Codeview is a debug format for win32/win64 PE/COFF files. It adds two sections,
.debug$S (symbols) and .debug$T (types), to the generated object file. These
sections are then used by the linker to generate a PDB file which can be used
by various debuggers (WinDbg, Visual Studio, etc).

Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-01-24 14:14:39 +03:00
Jim Kukunas
ba754eec03 Add a MD5 implementation
This implementation was written by Colin Plumb and
is in the public domain.

I've updated it to use stdint.h and the standard C types rather than
sys/types.h for portability.

Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-01-24 14:14:00 +03:00
H. Peter Anvin
4de7a764d5 Run "make alldeps" to add missing header file dependencies
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:14:52 -08:00
H. Peter Anvin
cd4c89bbb9 "make alldeps"
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 11:18:50 -08:00
H. Peter Anvin
45a22d9a61 iflag: Fix dependencies, factor out static components of iflag.h
Multi-dependencies don't work as expected, especially not across Make
versions, this is why we don't use them and read the instructions list
multiple times.

iflag.h has a lot of static content, so factor out the static content.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 11:13:10 -08:00
H. Peter Anvin
015774dc3f "make alldeps"
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-24 10:56:49 -08:00
Cyrill Gorcunov
ddf803b498 make: Update deps
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 13:21:04 +04:00
Cyrill Gorcunov
0835915c1d iflag: Start using new instruction flags engine
Here we start using instruction flags generator.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 13:20:59 +04:00
Cyrill Gorcunov
acfb97d3db make: Add 'golden' target
We've 'test' target in toplevel Makefile, lets be
complete and allow to generate "golden" tests from
toplevel as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-11-24 12:26:35 +04:00
Jin Kyu Song
5f3bfee708 disp8: Consolidate a logic to get compressed displacement
Consolidated two separate but similar functions in nasm and ndisasm
into a commonly linked source code.
To encode and decode the compressed displacement (disp8*N) for EVEX,
N value should be derived using various conditions.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 15:40:55 -08:00
Cyrill Gorcunov
32019da3a4 Revert "make: Remove generated files on clean target"
This reverts commit b6c7291b3d.

We already have this cleanup stage in "cleaner" target, I managed
to miss it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-10-28 11:35:55 +04:00
Cyrill Gorcunov
b6c7291b3d make: Remove generated files on clean target
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-10-27 21:15:47 +04:00
H. Peter Anvin
8bbf299307 Merge remote-tracking branch 'origin/master' 2013-10-24 14:17:23 +01:00
H. Peter Anvin
33eecb68c2 Makefile.in: always run "make alldeps" when "make dist"
"make dist" (tarball generation) really should include "make alldeps"
so the Makefile dependencies are correct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-10-24 13:57:57 +01:00
H. Peter Anvin
faf04eec3c Run "make alldeps" to update dependencies 2013-10-24 13:45:06 +01:00
H. Peter Anvin
165eead3b8 Makefile.in: generate manpages for "make dist"
Make sure the "dist" target generates the man pages.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-10-24 13:25:51 +01:00
H. Peter Anvin
d089c2251b Revert "build: Include pregenerated nasm manpages"
This reverts commit 99427bdb6c.

We don't include generated files in the repository, instead we should
pregenerate them for the tarball generation, just as we do for the
Perl-generated files.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-10-24 13:22:19 +01:00
Cyrill Gorcunov
99427bdb6c build: Include pregenerated nasm manpages
It's been reported that force people to install
asciidoc for man pages generation is not acceptible.
Just ship them pregenerated.

http://bugzilla.nasm.us/show_bug.cgi?id=3392262

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-07-22 10:09:35 +04:00
H. Peter Anvin
a9397830f7 Make the errors for missing man page tools comprehensible
A lot of confusion was had due to missing asciidoc...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-05-17 12:03:24 -07:00
Cyrill Gorcunov
1930007f3f make: Don't forget to generate manpage for all target
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-18 01:31:59 +04:00
Cyrill Gorcunov
1a63699ce5 man: Generate manpages from asciidoc format
The asciidoc format is a way more easier to read
by a human.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-02-17 22:50:19 +04:00
Cyrill Gorcunov
b5e8fec848 preproc: Move NOP preprocessor into separate file
No need to carry it in nasm.c, let it be more modular.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-05-07 11:34:27 +04:00