Commit graph

121 commits

Author SHA1 Message Date
H. Peter Anvin
6d36d8684c Fix implicit fallthrough that trips -Werror
-Werror now trips on implicit fallthroughs. There is also at least one
that probably should not be, although it appears to be harmless.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-05-08 12:45:00 -07:00
Cyrill Gorcunov
72fd205bcf Revert "Use fallthrough() to placate compiler"
This reverts commit 8a7c6009fb.
2018-02-25 22:25:07 +03:00
Cyrill Gorcunov
8a7c6009fb Use fallthrough() to placate compiler
https://bugzilla.nasm.us/show_bug.cgi?id=3392465

Reported-by: Ozkan Sezer <sezeroz@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 17:21:54 +03:00
H. Peter Anvin
84deac219d rdoff.c: one more unsafe use of fread()
Use the same error pattern as the rest of the calls in this function.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-17 14:25:13 -07:00
H. Peter Anvin
6edeb335f0 rdflib.c: fix(?) one more unsafe use of fread()
It isn't 100% clear what is the right thing to do in this particular
case, so this is my best attempt...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-17 14:22:32 -07:00
H. Peter Anvin
3d6d7331ab rdoff: add back rdfutils.h missing from previous checkin
Checkin 8dc965347d was missing this
file, causing obvious failures.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-17 14:14:26 -07:00
H. Peter Anvin
8dc965347d rdoff: use nasm-provided safe memory allocation and I/O
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>
2017-04-17 13:56:50 -07:00
H. Peter Anvin
9a714c98a2 rdoff: move rdoff build into main Makefile to make it build on Windows
NSIS packages rdoff, and we really want to be able to build the full
NSIS package on an MSVC platform.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 17:24:03 -07:00
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