Commit Graph

3121 Commits

Author SHA1 Message Date
H. Peter Anvin
140c214ad0 md5: use "compiler.h", WORDS_LITTLEENDIAN and make functions static
Look for WORDS_LITTLEENDIAN instead of the gcc-specific __BYTE_ORDER.
Use our existing "compiler.h" portability layer.
Make functions which are not exported static.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-03-02 10:54:24 -08:00
H. Peter Anvin
53f1559c06 Remove unnecessary C99-isms
In order to make it more likely to compile cleanly with "C90 plus long
long" style compilers, remove existing constructs (mostly commas at
the end of enums) that aren't compliant.

Ironically enough this was most likely an unintentional omission in
C90...

From master branch checkin 7214d18b40

Resolved Conflicts:
	output/outelf32.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-03-02 10:48:53 -08:00
H. Peter Anvin
8d9f591005 configure.in: add -fwrapv to gcc and compatible compilers
Add the -fwrapv to gcc and compatible C compilers, to enforce
deterministic 2's-complement behavior with regards to signed and
unsigned integer types.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-27 00:15:13 -08:00
Knut St. Osmundsen
52ae33a2cb Remove unnecessary C99 features which break Visual C++ 2010
Fixes Visual C++ 2010 breakage in recently added Codeview 8 code;
these are C99 features which were not necessary to introduce.

Signed-off-by: Knut St. Osmundsen <bird-nasm@anduin.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-26 23:44:10 -08:00
Knut St. Osmundsen
136c4bc73b doc: Remove --allow-64-bit leftover from help text.
Removes help text left behind when --allow-64-bit was turned into
default behavior + warning.

Signed-off-by: Knut St. Osmundsen <bird-nasm@anduin.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-26 23:44:07 -08:00
H. Peter Anvin
b170a0aad5 NASM 2.12 2016-02-26 20:48:52 -08:00
H. Peter Anvin
a85060520a changes.src: document Win64 build
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-26 20:47:45 -08:00
H. Peter Anvin
96edc04a39 nasm.spec.in: document buildrequires properly
We need asciidoc, xmlto, ghostscript, texinfo in order to be able to
build the documentation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-23 02:01:17 -08:00
H. Peter Anvin
d015a9f39e NASM 2.12rc7 2016-02-23 00:26:26 -08:00
H. Peter Anvin
ed8eb56546 outmacho: correctly handle references between sections
Correctly generate references between sections.  The previous
version would work correctly as long as all relative references
came from the first section, which is usually __TEXT,__text and
so it usually worked.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-23 00:13:49 -08:00
H. Peter Anvin
b7511971dc nasm.spec: change release to 0 to avoid distro conflicts
Change the RPM release number to 0 so that distribution-produced RPMs
will take precedence in all cases.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-22 01:18:33 -08:00
H. Peter Anvin
d4e001db67 NASM 2.12rc6 2016-02-21 21:07:35 -08:00
H. Peter Anvin
1ac2c2f55f misc/tag-release: default to --no-push
--no-push is by far the safer default.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-21 21:07:11 -08:00
H. Peter Anvin
021b10ca14 misc/tag-release: die on unknown options
If someone specifies an unknown option, they proabably typoed
something.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-21 21:05:16 -08:00
H. Peter Anvin
408b200684 NASM --rel=2.12rc6 2016-02-21 21:03:47 -08:00
H. Peter Anvin
a222d21138 outmacho: make a best effort at separating SIGNED from BRANCH relocs
For 64 bits, a BRANCH reloc is sometimes needed to fix up PIC
problems.  Make a best effort at generating BRANCH relocs just as
we make a best effort at distinguishing GOTLOAD from GOT.

This needs to be replaced with information from the assembler to
the backend.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-21 20:56:19 -08:00
H. Peter Anvin
114ba75f7b test/Makefile: add a rule for nasm itself
If NASM needs to be rebuilt, build it in the proper directory.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 13:06:04 -08:00
H. Peter Anvin
44a609b203 configure.in: add --enable-werror option
Add an option to compile with -Werror, useful for development.

Change --with-ccache to --enable-ccache to match guidelines.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 12:09:31 -08:00
H. Peter Anvin
b423c02ad2 Platform compatibility improvements
Windows: indicate that we support multibyte character sets in file
names.

Unix: support gigantic input and output files.  Might be useful
especially in the presence of the INCBIN directive.

Signed-off-by: H. Peter Anvin <hpa@linux.kernel.org>
2016-02-18 11:57:53 -08:00
H. Peter Anvin
dea76e7779 NASM 2.12rc5 2016-02-18 11:50:42 -08:00
H. Peter Anvin
277308f1f3 doc: update documentation for a version 2.12 release
Add documentation updates for version 2.12.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 11:49:33 -08:00
H. Peter Anvin
5f0e601f98 doc/rdsrc.pl: escape braces in regular expression to support newer Perl
Newer versions of Perl require literal braces in regular expressions
to be escaped.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 11:48:12 -08:00
H. Peter Anvin
4afa730c03 outmacho: default section flags should depend on section name only
The __TEXT segment in particular contains both code and data.  The
most consistent thing is to look only at the section name, and have
the same behavior across sections.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 10:55:00 -08:00
H. Peter Anvin
9e122a6603 realpath: if we can't get the full path, return the known portion
Right now, we don't check the return value from nasm_realpath();
furthermore doing so and failing is probably not the ideal behavior.

If we can't get the full canonical path, then punt and just return
nasm_strdup() of the known path name; better than nothing.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 01:53:47 -08:00
H. Peter Anvin
11b8817e8a listing: remove unused variable
The previous commit contained an unused variable, remove it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-17 20:33:02 -08:00
H. Peter Anvin
d2ea49b326 listing: change the line numbers to match the source code
Instead of completely useless sequential line numbers, emit line
numbers corresponding to the line numbers in the source code.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-17 15:38:51 -08:00
H. Peter Anvin
777b7b1d25 Merge tag 'nasm-2.12rc4'
NASM 2.12rc4

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-17 14:35:48 -08:00
H. Peter Anvin
9f7c68a519 changes.src: more updates for 2.12
More updates in preparation for NASM 2.12.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-17 13:44:51 -08:00
H. Peter Anvin
43e0c3cf8d outmacho: make a copy of "fmt" instead of making it a pointer
Make a point of the output format constants instead of making it
a pointer.  The output format is set only once, but it is accessed
all the time.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-17 13:28:19 -08:00
Cyrill Gorcunov
1452990979 docs: Fix typo in previous commit
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-02-17 17:02:34 +03:00
Cyrill Gorcunov
2338613e6b docs: changes -- Prepare for 2.12
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2016-02-17 17:00:06 +03:00
H. Peter Anvin
a648b90eab NASM 2.12rc4 2016-02-16 22:32:58 -08:00
H. Peter Anvin
dde34c51b3 outmacho: correct handling of GOT relocation, add TLVP relocations
Correct the handling of GOT relocations, as they need a symbol
reference.  Add handling of TLVP relocations; it is unclear to me
if non-local relocations in TLVP space is permitted.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 22:15:03 -08:00
H. Peter Anvin
085a4a9f98 outmacho: fix the .rodata -> __TEXT,__const mapping
For the mapping of .rodata to __TEXT,__const in the absence of
relocations, it would help if we changed the segment name *before* we
emit that part of the load command.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 18:04:39 -08:00
H. Peter Anvin
82a3082d64 raa: move private parts of the implementation into raa.c
Move the private aspects of the implementation into raa.c instead
of exposing it to raa.h.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 17:47:25 -08:00
H. Peter Anvin
ec62791d8c outmacho: sanitize the handling of sections
Sanitize the handling of sections in outmacho somewhat.  This should
bring further performance improvements.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 17:38:58 -08:00
H. Peter Anvin
2c4a4d5810 Simplify handling of segments and segalign
Slightly simplify the handling of segment number allocation.
If we are in absolute space, never push a segalign down to the backend.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 17:37:18 -08:00
H. Peter Anvin
6fc2b123af outmacho: if .rodata contains no relocations, change it to __TEXT,__const
If we specify .rodata as opposed to the explicit __DATA,__const, and
we end up with no relocations, change it to __TEXT,__const per the
Mach-O ABI.  However, it is generally better for the programmer to
explicitly specify the items that should go into __TEXT,__const as
otherwise a single relocatable item will force the whole thing into
__DATA.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 12:56:27 -08:00
H. Peter Anvin
d1da074b83 outmacho: Allow arbitrary MachO sections, avoid bss lookup
Allow specifying sections with arbitary MachO segment and section
names, as opposed to having a fixed list of supported sections
(especially __DATA,__const is wrong in some cases.)  Furthermore,
we do a completely unnecessary lookup of the bss section *for every
call to macho_output()* which is just plain crazy.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 12:39:26 -08:00
H. Peter Anvin
615ef1a6f8 outmacho: Only test for MAX_SECT at the point sections are laid out
Exceeding MAX_SECT is not a warning, it is a fatal error.  However,
there is no point to test for it until we already process all the
sections.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 11:42:13 -08:00
H. Peter Anvin
e1eb7b8880 outmacho: Fix the computation of non-external relocation offsets
When we clear the ext bit, creating section-relative relocations,
the resulting value is computed somewhat differently; we need to
adjust for that.

TODO: Need to make sure we do the right thing for ALL relocations.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-16 11:30:54 -08:00
H. Peter Anvin
4e5fbcb81b outmacho: use section table lookup for local symbol references
When generating local symbol references, don't loop over all the
sections like we used to...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-16 00:29:48 -08:00
H. Peter Anvin
c44bfaa054 Merge branch 'master' of git://repo.or.cz/nasm 2016-02-15 23:44:43 -08:00
Ozkan Sezer
ec3d426e36 configure.in: Add -Werror flags last (BR 2292332)
configure.in: Add the -Werror flags as the last thing. Otherwise, with
development versions of autoconf, all AC_CHECK_FUNCS calls fails with:
conftest.c:49: error: function declaration isn't a prototype
conftest.c:49: warning: conflicting types for built-in function 'strcspn'

Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-02-12 23:49:56 -08:00
H. Peter Anvin
ddf424758c NASM 2.12rc3 2016-02-12 21:24:32 -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
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
941356b2ca outmac: generate section-relative relocations for local symbols
We generate section-relative relocations for local symbols for all
the other output formats, and we should do the same for MachO;
this was done in MachO-32 but not in MachO-64, presumably because
the MachO spec implies that such relocations shouldn't exist in
64-bit code.  They are indeed rare, but that is a programmer's
decision, and the spec is clear that they are legal.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-12 15:06:23 -08:00
H. Peter Anvin
ca351fa175 assemble.c: when converting an address to RAWDATA, need to update size
When converting an address to RAWDATA we have to copy the address size
into the size variable, as the size variable may be negative.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-12 13:49:45 -08:00
H. Peter Anvin
fc1a7ad662 outmac: correct the format name for macho32
The name for the macho32 output format was incorrectly set to
macho64, which means neither macho32 nor macho64 worked correctly.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-12 13:36:37 -08:00