Commit Graph

113 Commits

Author SHA1 Message Date
H. Peter Anvin
14858d7343 Makefiles: distribute file generation rules via syncfiles.pl
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>
2017-04-03 11:13:29 -07:00
Martin Lindhe
a6ccf005a5 rdoff: check return value of freopen
fixes pvs-studio error 'V530 The return value of function 'freopen'
is required to be utilized.'

Signed-off-by: Martin Lindhe <martin-commit@ubique.se>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-01-05 22:38:41 +03:00
H. Peter Anvin
8220533cda rdoff/rdlar.h: include "compiler.h" not "config.h"
We should not include config.h "naked"; include "compiler.h".

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-10-06 14:18:21 -07:00
H. Peter Anvin
e93572e6be Merge remote-tracking branch 'origin/nasm-2.12.xx' 2016-10-04 14:09:07 -07:00
Daniel Lundqvist
439875c1d9 ldrdf: Remove output file if there are any errors
If there are any errors while linking, we should not create an
output file.

Signed-off-by: Daniel Lundqvist <daniel@malarhojden.nu>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-04 03:36:27 -07:00
Cyrill Gorcunov
43bb293432 Merge branch 'nasm-2.12.xx'
* nasm-2.12.xx:
  codeview: Fix ill-formed "S_COMPILE2" record.
  rdoff: Add rdf2bin input dependency
  labels: Warn if new label created on pass two
  Add explicit void parameter to newmembuf() function declaration.
  compiler.h: always undefine __STRICT_ANSI__ for gcc

| Conflicts:
|	rdoff/Makefile.in

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-27 01:08:51 +03:00
Fabian Giesen
199f3d7354 rdoff: Add rdf2bin input dependency
On host platforms where $(LN_S) is cp, need to make sure to
link rdf2bin first.

Backport of 6d67dbfa95

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-27 01:03:45 +03:00
Fabian Giesen
6d67dbfa95 rdoff: Add rdf2bin input dependency
On host platforms where $(LN_S) is cp, need to make sure to
link rdf2bin first.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-07-18 14:52:27 +03:00
bcallah@devio.us
065c34273c Add explicit void parameter to newmembuf() function declaration.
In rdoff/rdoff.c, the function declaration for newmembuf is written:
static memorybuf *newmembuf()
The attached diff adds an explicit void parameter.
It seems like it would be nicer with an explicit void parameter
especially since the -Werror build options seem to want to find such
things.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-07-14 14:15:41 -07: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
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
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
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
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
2bc798a968 rdflib: actually get the time
sizeof(t = time(NULL)) doesn't ever actually call time().

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-12 21:21:57 -08:00
Yuri Zaporozhets
d9ca54b6d2 rdoff/ldrdf.c: Add option to specify target RDF module name in command line
Rationale: this is useful for projects developed entirely in high-level
language and which use NASM as a backend (compilers able to generate NASM
code are e.g. ncc or Free Pascal). With this option there is no need to have
a single assembly language file for each project with just one "module NNN"
directive — it is enough now to specify the name as an argument to ldrdf.

Signed-off-by: Yuri Zaporozhets <r_tty@yahoo.co.uk>
2015-01-20 23:38:52 +02:00
Yuri Zaporozhets
7a33af2904 Correct name spelling and email address
Signed-off-by: Yuri Zaporozhets <r_tty@yahoo.co.uk>
2015-01-18 20:21:14 +02:00
Yuri Zaporozhets
76ee8e6091 rdoff: increase EXIM_LABEL_MAX to 256 bytes
Rationale: this is required for, e.g., FreePascal, which tends to generate
very long labels for procedures/methods that do not fit into 64 bytes.

This change does not introduce any incompatibilities.

Signed-off-by: Yuri Zaporozhets <r_tty@yahoo.co.uk>
2015-01-11 21:16:34 +02:00
H. Peter Anvin
12c0702824 rdoff/rdlib.c: Remove unused function rdl_close()
The function rdl_close() is never used, remove it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2015-01-05 15:21:43 -08:00
H. Peter Anvin
ad2acd7754 Add missing static declarations in rdoff/segtab.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:35:29 -08:00
H. Peter Anvin
31bcb6f866 Add missing static declarations in rdoff/rdoff.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:35:16 -08:00
H. Peter Anvin
b06da211f4 Add missing static declaration in rdoff/rdlib.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:34:34 -08:00
H. Peter Anvin
48166388d5 Add missing static declarations in rdoff/rdflib.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:34:03 -08:00
H. Peter Anvin
ef18237372 Add missing static declaration in rdoff/rdfdump.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:33:33 -08:00
H. Peter Anvin
c9f0447079 Add missing static declarations in rdoff/ldrdf.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:14:52 -08:00
Jim Kukunas
e184c0b0cb rdoff: don't check fwritezero() return value.
Since e76a626055, the return type of fwritezero()
is void.

Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
2014-11-10 11:45:10 -08:00
Philipp Kloke
c7b53ffe1f Fixed two more resource leaks in rdoff/rdlib.c
Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:17:46 +04:00
Philipp Kloke
efe66c65d1 Fixed three possible buffer overflows
Bug found by: CppCheck 1.59 (static source analysis tool)

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:16:58 +04:00
Philipp Kloke
dae212d049 Fixed several resource and memory leaks
Bug found by: CppCheck 1.59 (static source analysis tool)

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-04-01 02:16:27 +04:00
H. Peter Anvin
bf5652d220 rdoff: add missing dependency in Makefile
Add back a dependency which was accidentally dropped for the previous
build bug fix.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2011-06-23 13:40:06 -07:00
H. Peter Anvin
c050362865 Makefile: hopefully fix rdoff parallel build problems
The strange dependency on nasmlib.o causes serious issues in parallel
build; hopefully fix it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2011-06-23 13:26:59 -07:00
Victor van den Elzen
0dd450c0ef Use fputs instead of fprintf for plain strings
LLVM's Clang warns about this. outieee.c had a real problem.
2009-08-13 15:07:59 +02:00
H. Peter Anvin
8ee2e244eb NASM: relicense under the 2-clause BSD license
*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>
2009-07-06 11:09:11 -07:00
H. Peter Anvin
7ae512b5a8 More "make install" fixes... 2009-07-05 18:48:50 -07:00
H. Peter Anvin
2fa822b3b3 rdf2bin: be smarter about extracting the format from argv[0]
Consider that argv[0] may contain extensions like .exe as well as
pathname prefixes.  Handle it by searching backwards for the string
"rdf2" and then extract the alphanumeric tail that follows.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05 18:31:33 -07:00
H. Peter Anvin
662b3fe3a4 rdoff: fix "make install"
Fix "make install" for the new rdf2bin aliases.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05 17:08:46 -07:00
H. Peter Anvin
7f2c476297 rdf2bin.1: add missing space
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 22:36:03 -07:00
H. Peter Anvin
06c05ae72a rdoff/test/Makefile: actually do build tests
Add actual Makefile rules for the rdoff tests.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 21:19:37 -07:00
H. Peter Anvin
a0374589aa rdf2bin: update man page, add link pages for aliases
Update the rdf2bin man page; add link man pages for the various
command aliases.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 21:11:21 -07:00
H. Peter Anvin
c1f13fc80f Correct the legacy name rdf2ihx (as opposed to rdf2ith)
The more common acronym for Intel Hex seems to be "ith", but the
legacy utility was "rdf2ihx", so we allow both variants.  However, the
Makefile rule was wrong.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 21:02:33 -07:00
H. Peter Anvin
1e5b102109 rdf2bin: revamp so it can output bin, ith, or srec
Revamp rdf2bin so it can output binary, Intel hex, or Motorola
S-records.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 15:30:48 -07:00
H. Peter Anvin
099f05dce4 rdfload: make the base addresses unsigned
Make the base addresses in rdfload unsigned.  Note: this file is
really obsolete; it can't represent RDF2 with more than the 3
old-style segments.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 15:28:45 -07:00
H. Peter Anvin
6c98ca4ddc Remove rdf2ihx.c, since it looks unlikely we'll get it relicensed.
Remove rdf2ihx.c since I think it's unlikely we'll ever get it
relicensed -- any attempts at contacting the author has failed, and
it's easier to reconstruct it from scratch.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-03 13:40:57 -07:00
H. Peter Anvin
c8578cec67 Add new copyright headers to the rdoff code
To the best of my knowledge, the only file which we don't have 2-BSD
relicensing permission for at this stage is rdf2ihx.c.  That file
probably should just be rewritten, if anyone cares.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28 17:33:50 -07:00
H. Peter Anvin
999868f06f Unify all-zero buffers; add fwritezero()
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.
2009-02-21 17:24:08 -08:00
H. Peter Anvin
9726b1e971 rdx: Add cast avoid warning from gcc
Avoid a warning from gcc about casting an integer of different size to
a pointer.
2008-05-20 14:25:36 -07:00
Bo Borgerson
7d4d2c3cc9 Avoid some warnings in rdoff/rdf2bin.c
I received some warnings when running make on the head revision of
nasm from git:

----
rdf2bin.c: In function 'main':
rdf2bin.c:122: warning: comparison between signed and unsigned
rdf2bin.c:123: warning: comparison between signed and unsigned
rdf2bin.c:124: warning: comparison between signed and unsigned
----

I think these warnings are innocuous and should be safely avoidable
with simple casts (please see attached patch).

* rdoff/rdf2bin.c
(main): cast to size_t for comparison with fwrite return value

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-04-12 11:12:14 -07:00
Charles Crayne
b8b1a61d10 Define MKDIR for rdoff make file
Addition of rdoff man pages uses MKDIR, which was not defined
2007-12-30 14:24:10 -08:00