Commit graph

13 commits

Author SHA1 Message Date
H. Peter Anvin
276785a8ff config: add configuration file for unknown compilers
Add a config header file for the most conservative case of a totally
unknown compiler.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-10-04 17:13:50 -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
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
9924d1ea85 preproc: clean up handing of the dependency lists
We search the dependency list anyway (ouch...) so we might as well
use that instead of keeping track of a tail pointer.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-04 00:59:39 -07:00
H. Peter Anvin
169ac7c152 Add a hash for pathname searches, instead of searching very pass
We have been doing a pathname search every time we encounter a file,
which means every file in every pass.  Instead, put the pathnames
found in a hash table.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-09-25 17:08:05 -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
04445364fc incbin: if we have to fread(), try to do it only once...
If we can't mmap a file and instead have to fread(), if the data is
small enough that we can reasonably accomodate it in a memory buffer,
then just read it once.

It seems rather unlikely that very large files would be used with
TIMES anyway.

Also note: the previous comment about nasm_file_size[_by_path]() being
invoked twice was spurious; it does not actually happen.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-21 15:56:19 -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
c170089e7c nasmlib: move fseeko/ftello/off_t replacements to nasmlib.h
Move fseeko, ftello, and off_t definitions to nasmlib.h so that files
other than nasmlib/file.c can use them (already added to
asm/assemble.c).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-20 18:26:42 -07:00
H. Peter Anvin
a77692b34d New backend interface - assembler internals #1
This provides the first pass of assembler internals for a new, richer,
backend interface.  It also reduces the amount of data carried in
function parameters inside the assembler.

The new interface is in the form of a structure, which will contain
substantially more information that the previous interface.  This will
allow things like ELF GOT32X and Mach-O X86_64_RELOC_BRANCH
relocations to be reliably emitted.

This provides the initial set of structures.  Future additions should
include:

1. Pass down the base symbol, if any.
2. Segments should be a structure rather than a number, and the
   horrible hack of adding one for a segment reference should be
   removed (OUT_SEGMENT replaces it.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-09-20 16:05:09 -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
H. Peter Anvin
f7606613d0 Handle multiple standard macro sets sanely
The ordering of the macro sets ended up changing due to the recent
file reorganization.  Instead of forcing the order again, handle
multiple macro sets (rather than just two) in a coherent manner.

macros/macros.pl could use a cleanup of duplicated code, however.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-07-13 14:23:48 -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