0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-07-24 10:25:42 -04:00

3771 Commits

Author SHA1 Message Date
Cyrill Gorcunov
b09d64eff3 output: macho -- Use macho_relocation_info_t
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
3dd7a1ab98 output: macho -- Use native macho_relocation_info_t
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
fa832e1b9f output: macho -- Rename sect_attribs to macho_known_section_attr
To unify with macho_known_section in namings.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
11afb191c5 output: macho -- Use lookup_known_section helper
To make it similar to elf code and eliminate code duplication.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
e0d858ce88 output: macho -- Beautify known sections
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
115fdb1fe7 output: macho -- Use macho_symtab_command_t
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
2d620be231 output: macho -- Start unifying code for macho32, macho64
Just like we have for Elfx/32/64 engine.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
758ad5020a output: macho -- Drop OF_ ifdefs
We're building both anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
6a22eb4dd5 output: macho -- Move constants into the header
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
9f4ca1d881 travis: nasm-t.py -- Show compilation errors in output
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
4a2b0d7516 travis: nasm-t.py -- Fix typo
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
1cf8920961 travis: Disable osx for a while
osx update takes too long, disable it for a while.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
ea6ad22f5d Add travis status into readme
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
a3afa40d83 test: travis -- Add some of converted tests
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
6abd27d021 test: travis -- Add initial support
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
b4b63a54d3 README: Update link to license
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
Cyrill Gorcunov
3ceb189a4f Convert README to md format
And update it a bit.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-09 18:03:50 +03:00
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
Chang S. Bae
f0ceb1e122 assemble: Check global line limit
Without the limit, the while loop opens to semi-infinite
that will exhaustively consume the heap space. Also, the
index value gets into the garbage.

https://bugzilla.nasm.us/show_bug.cgi?id=3392474

Reported-by : Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-05 23:44:33 +03:00
Chang S. Bae
427d8e3e57 output: macho -- Avoid conversion of addresses to RAWDATA
Without relocation, the linker may do erroneous dead strip.
For the relocation, the conversion of addresses to RAWDATA
should be avoided for Mach-O.

https://bugzilla.nasm.us/show_bug.cgi?id=3392469

Reported-by: Andrew Fish <afish@apple.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-05 23:44:33 +03:00
Chang S. Bae
69ed82447a output: macho -- Check the actual size of 64-bit absolute address
Even though the size is set to 64-bit, actual value can be
in 32-bit range. In that case, the use of such absolute
address is prevented.

The side effect of 58d2ab17 is resolved.

https://bugzilla.nasm.us/show_bug.cgi?id=3392468

Reported-by: Richard Russell <rtrussell@gmail.com>
Reported-by: Michael Petch <mpetch@capp-sysware.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-05-05 23:43:57 +03:00
Fabian Giesen
713fd1ffc8 output: codeview -- change version number written
Windows Store and Xbox One apps need to pass WACK, the Windows App
Certification Kit, and part of that process involves a tool named
BinScope that checks the debug info of all object files making up
the final executable against a list of minimum versions.

These minimum versions get increased periodically as new SDKs and
compilers are released. In a patch 2 years ago, I made NASM
pretend it was MASM and output a then-current MASM version number.

Well, the minimum version number has increased again, and
periodically hardcoding a new random MASM version to keep BinScope
happy doesn't seem like the way to go.

It turns out that BinScope does not impose any minimum version
requirements on object files listing a source language BinScope
doesn't know about.

I have no idea how to officially request a new CodeView language
ID (or whether there even is a way to do so for someone outside
MS). But experimentally, using 'N' (0x4e) for NASM seems to be
working just fine and is far away from the range of currently
allocated language IDs (which stop at 0x10).

Long story short, make NASM emit a source language ID of 0x4e,
with the actual NASM version in the version number fields.
BinScope is happy to accept that, and since the language ID field
is purely an informational field in an optional debug info record
that (as far as I can tell) is not used for anything else, this
seems reasonably safe and unlikely to cause trouble.

Signed-off-by: Fabian Giesen <fabiang@radgametools.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-04-20 11:27:19 +03:00
Cyrill Gorcunov
dd6a2cdcf4 Revert "compiler: Add fallthrough() helper"
This reverts commit 8ba28e13ea4453a587d08e5533e60f4ff2b4781a.
2018-02-25 22:25:57 +03:00
Cyrill Gorcunov
72fd205bcf Revert "Use fallthrough() to placate compiler"
This reverts commit 8a7c6009fbddd7084fdfaebd9e3e3fd0baa39bc2.
2018-02-25 22:25:07 +03:00
Cyrill Gorcunov
5829bbd9ed Revert "aclocal.m4: Use Werror in PA_CHECK_FALLTHROUGH_ATTRIBUTE"
This reverts commit 8b211a0a3b87999ffe38d03ba1e01639bfc05db0.
2018-02-25 22:24:53 +03:00
Cyrill Gorcunov
8b211a0a3b aclocal.m4: Use Werror in PA_CHECK_FALLTHROUGH_ATTRIBUTE
In sake of https://bugzilla.nasm.us/show_bug.cgi?id=3392465

Suggested-by: Ozkan Sezer <sezeroz@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 22:01:20 +03:00
Cyrill Gorcunov
562561640d insns.dat: Update UD0 encoding to fit the specification
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 18:50:52 +03:00
Matthieu Darbois
9adfd34b03 output: macho -- Add support for N_PEXT in macho output
This allows to mark global symbols as private external.
Similar to visibility hidden in ELF output.

Signed-off-by: Matthieu Darbois <mayeut@users.noreply.github.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 17:41:54 +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
Cyrill Gorcunov
8ba28e13ea compiler: Add fallthrough() helper
https://bugzilla.nasm.us/show_bug.cgi?id=3392465

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 17:09:11 +03:00
Cyrill Gorcunov
fb9e00a1c3 output: outobj -- Fix typo in obj_init
In 51b453b0970a1d66c3f6533ed940cb9838ba2b18 occasionally
used wrong operand for sizeof.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 16:12:34 +03:00
Cyrill Gorcunov
51b453b097 output: elf,ieee,macho,obj -- Fix mofule name for commit 81b62b9f54ac8e4019a9b2ec2b95ec0faa86bd2a
These modules need a reference to input filename.
For example elf put into symbol table

 | SYMBOL TABLE:
 | 0000000000000000 l    df *ABS*	0000000000000000 sha-64.asm

Otherwise this  become empty string.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 15:50:35 +03:00
Cyrill Gorcunov
8a231080e0 get_cpu: Fix a7ecf2646d6c80b994be7d340140379d580050cf
The call to iflag_clear_all has been occasionally dropped,
bring it back.

https://bugzilla.nasm.us/show_bug.cgi?id=3392466

Reported-by: sezeroz@gmail.com
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-25 13:25:19 +03:00
Cyrill Gorcunov
fff27ab229 compiler: Fix typo in 6686fc6
https://bugzilla.nasm.us/show_bug.cgi?id=3392464

Reported-by: sezeroz@gmail.com
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-24 15:11:32 +03:00
H. Peter Anvin
b9fa743974 openwcom.mak: use \ as path separators
Apparently OS/2 really wants \ as path separators, and that is really
the main target for OpenWatcom these days, so change the path
separator in this Makefile.  For building on Linux we'd be better off
with a GNU Makefile anyway, but what is the point, really...

Reported-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-02-22 15:02:42 -08:00
H. Peter Anvin
281f5bd92c Merge branch 'master' of ssh://repo.or.cz/srv/git/nasm 2018-02-22 14:53:46 -08:00
H. Peter Anvin
6686fc627e Introduce cold function attribute
Attribute to deemphasize certain code paths.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-02-22 14:52:50 -08:00
H. Peter Anvin
6feef84f25 outbin: check the status of lookup_label()
Make sure we actually found the label we looked at, to avoid undefined
behavior.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-02-22 14:51:59 -08:00
H. Peter Anvin
7418883b62 outelf: fix possibly uninitialized variable
Fix possibly uninitialized variable "currfile".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-02-22 14:51:26 -08:00
H. Peter Anvin
4dbf3a96a4 Merge remote-tracking branch 'origin/nasm-2.13.xx'
Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-20 12:40:11 -08:00
H. Peter Anvin
99d45c850e Fix problem with C99 inlines and -Werror=missing-prototypes
Some older versions of gcc (gcc 4.2.1 at least) produce a warning,
promoted to error, on C99 inlines.  Do some work to figure out if we
need to fall back to GNU inline syntax.

Fix some issues with GNU inline syntax.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-20 12:34:17 -08:00
H. Peter Anvin
f71820d605 version: bump to 2.13.04rc0 until we have an actual -rc
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-14 11:13:05 -08:00
H. Peter Anvin
8524e16303 insns.dat: add aliases of the RET instruction with explicit operand size
Make it possible to generate variants of RET(F) with explicit operand
size specified without having to use o16/o32/o64.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-14 11:09:07 -08:00
Cyrill Gorcunov
53371ddd17 Merge branch 'nasm-2.13.xx'
* nasm-2.13.xx:
  nasmlib: Drop pure_func attrib from seg_alloc
  nasmlib: Drop unused seg_init
2018-02-10 00:44:07 +03:00
Cyrill Gorcunov
9f45a77f46 nasmlib: Drop pure_func attrib from seg_alloc
It not only reads static variable but writes it back as well.

https://bugzilla.nasm.us/show_bug.cgi?id=3392461

Reported-by: Michael Šimáček <msimacek@redhat.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-10 00:40:46 +03:00
Cyrill Gorcunov
5eb1838b4d nasmlib: Drop unused seg_init
The helper has been eliminated in 2c4a4d5810d0a59b033a07876a2648ef5d4c2859

https://bugzilla.nasm.us/show_bug.cgi?id=3392461

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-02-10 00:34:10 +03:00
H. Peter Anvin
3366e31b8a asm: allow abort on panic to be specified at runtime
New option --abort-on-panic to make debugging easier.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-07 14:14:36 -08:00
H. Peter Anvin
1b53750430 Merge tag 'nasm-2.13.03'
NASM 2.13.03

Resolved Conflicts:
	include/iflag.h
	version
	x86/insns-iflags.ph

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-07 13:51:54 -08:00
H. Peter Anvin
ef7d18bfbb NASM 2.13.03 nasm-2.13.03 2018-02-07 13:38:58 -08:00
H. Peter Anvin
cb7b097b3e doc: some more documentation on 64-bit programming
Some more information about 64-bit programming and its quirks.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-02-07 12:28:42 -08:00