Commit Graph

18 Commits

Author SHA1 Message Date
H. Peter Anvin
2d89477ef4 configure.ac: smarter way to handle -O2 -> -O3 default change
We don't want to tack on -O3 if the user has specified, say,
CFLAGS='-g -O1' for debugging.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-01 12:57:46 -08:00
H. Peter Anvin
0c36965335 configure.ac: make possible to compile with -ffunction/data-sections
The -ffunction-sections and -fdata-sections, if supported, can enable
the linker to do some amount of dead code elimination.  Basically a
very basic form of LTO.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-02-28 19:34:36 -08:00
H. Peter Anvin
9b935a0ea8 configure.ac: default to -O3
Default to -O3 instead of -O2.  The code gets somewhat bigger, but
nasm is full of tiny functions called from all over the place.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-02-28 19:02:51 -08:00
H. Peter Anvin
5fe847e590 Makefile: make it possible to compile with gcc link-time optimization
Put in the necessary machinery to compile with gcc link-time
optimization.  This means compiling and linking with -flto, as well as
using gcc-ar and gcc-ranlib instead of the normal tools.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-02-28 18:48:01 -08:00
H. Peter Anvin
895a66cbcb configure.ac: use AC_FUNC_MMAP instead of AC_CHECK_FUNCS(mmap)
There are a couple of extra checks in autoconf for mmap, supposedly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-02-23 20:34:38 -08:00
H. Peter Anvin
bc18af18f0 configure: make sure we flag invalid attributes
Use -Werror=attributes so we can actually test for non-supported
attributes without spewing warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-02-23 19:22:27 -08:00
H. Peter Anvin
abd28c9ab9 If we have new features introduced by C11, use them
Instead of using hacks or compiler-specific features, if we have
standard features as defined in ISO C11, use them.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-12-20 02:29:58 -08:00
H. Peter Anvin
8d4fb26ad4 Various fixes to the ilog2 functions
Fix several bugs in the ilog2 functions.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-11-15 14:23:54 -08:00
H. Peter Anvin
8b19083483 Better support for function attributes, autoconf cleanups
Use autoconf to detect function attributes; some compilers like Sun CC
do support some gcc-style attributes, but don't define __GNUC__.  Also
-U__STRICT_ANSI__ already in configure.ac so our tests match what we
might eventually encounter.

Add const_func and pure_func attributes.

Decorate functions in nasmlib.h with const_func and pure_func.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-11-15 14:01:37 -08:00
H. Peter Anvin
4c9132e3a0 compiler.h: include <sys/types.h>
Apparently, at least on some OS/2 compilers, <sys/types.h> needs to be
included for off_t to be defined.  This seems like a generically good
idea to include this header whenever it is available.

Remove reference to <types.h>.  This was supposedly for MSVC, but
there is no actual evidence that it is useful beyond <sys/types.h>.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-10-19 13:13:38 -07:00
H. Peter Anvin
397c169736 Move config.h to a subdirectory, add MSVC-specific config file
Instead of trying to do hacks in the Makefiles, define header files
for specific compilers if they can't use autoconf.  Currently defined
for Microsoft Visual Studio, based on MSDN documentation.  It is
currently untested.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-10-04 17:01:59 -07:00
H. Peter Anvin
d81a235f33 file: improve the file access interface
A number of fairly common operations are invoked way too many times,
especially when using incbin.  Drastically reduce the number of system
calls that need to be executed, and use memory mapping to reduce
unnecessary double buffering.

We could improve this further by leaving files open once used;
however, that might run into file count problems on some systems.

Still unclear is why we seem to invoke nasm_file_size() twice per pass
for incbin.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-21 14:07:17 -07:00
H. Peter Anvin
43e026277b configure.ac: disable common data to avoid problems with some linkers
Disable common data to:

a) discover problems with common data as quickly as possible (we
   should not use common data as some compilers may not handle it);
b) work around a problem with the OSX linker causing it to not find
   zero_buffer even though it is defined in nasmlib/zerobuf.c.

Reported-by: anonymous coward <nasm64developer@users.sf.net>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-08-02 09:28:22 -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
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
7baac1e7f8 Merge remote-tracking branch 'origin/nasm-2.12.xx' 2016-05-16 21:36:53 -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
b156bc8c61 autoconf: rename configure.in to configure.ac
In accordance with current practice, rename configure.in to configure.ac.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-03-16 02:13:43 -07:00