Commit graph

2095 commits

Author SHA1 Message Date
H. Peter Anvin
d68d9181df openwcom.mak: drop /f from delete commands
Classic DOS doesn't have del /f, and we don't really need it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-15 10:49:09 -07:00
H. Peter Anvin
5e2e8b9105 Rename filenames to 8.3 format
Apparently some people still care about compiling native on MS-DOS,
and we don't have a significant number of files which need adjustment.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-15 10:47:16 -07:00
Cyrill Gorcunov
985d880c15 expand_mmac_params: Expand local single macros unconditionally
Peter proposed to expand local single macros unconditionally.
This should not hurt but give us more cleaner code in result.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-08 18:45:06 +04:00
Cyrill Gorcunov
1f6741fc78 expand_mmac_params: Expand local single macros unconditionally
Peter proposed to expand local single macros unconditionally.
This should not hurt but give us more cleaner code in result.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-08 18:39:56 +04:00
H. Peter Anvin
b714cb27cb outobj: handle compilers without 64-bit switch() support
OpenWatcom, in particular, doesn't handle switch() statements with
64-bit expressions, sigh.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-07 11:34:28 -07:00
H. Peter Anvin
4dff757ba5 outelf32: handle compilers without 64-bit switch() support
OpenWatcom, in particular, doesn't handle switch() statements with
64-bit expressions, sigh.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-06-07 11:26:11 -07:00
Cyrill Gorcunov
b1a1e69a8f NASM 2.09rc1 2010-06-06 00:13:43 +04:00
Cyrill Gorcunov
640edfd784 nasmdoc: Document macro parameters range
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-05 11:24:59 +04:00
Cyrill Gorcunov
2f40375077 expand_mmac_params_range: Simplify condition
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-05 10:47:10 +04:00
Cyrill Gorcunov
c57eb51527 preproc.c: Fix argument indices checking in parameters range
Otherwise %{-1:-1} fails.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-05 01:58:10 +04:00
Cyrill Gorcunov
c29404d7ba preproc.c: Introduce macros parameters range expansion
Introduce an ability to expand multi-line macros parameters in
a range/sequence manner.

For this purpose a special form is introduced %{x:y} which means to
expand %{x:y} to %{x},%{x+1},%{x+2},...,%{y}.

Both arguments could be negative or positive but MUST NOT be zero.

The arguments take into account possible %rotate as well.

Note that unlike the approach implemented in yasm we refer :-1 as
_last_ argument passed to a macro call, this makes possible to refer
the last element from macro via record as %{-1:-1} which could be
a convenient trick.

Also you can refer the argument in reverse order, ie it's legitime
to write %{5:4}, or even to reverse the all arguments %{-1:1}.

An example

 |
 | %macro mpar 1-*
 |     db %{1:-2}
 | %endmacro
 |
 | mpar 1,2,3,4,5,6

in result we'll get the sequence of 1,2,3,4,5

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Inspired-by: Mathieu Monnier <mathieu.monnier@polytechnique.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-05 01:50:59 +04:00
Cyrill Gorcunov
ca61119a01 expand_mmac_params: Format condition
It's much easier to read aligned

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-04 22:16:54 +04:00
Cyrill Gorcunov
a731924978 nasmlib: Rename elements() macro to ARRAY_SIZE
ARRAY_SIZE is a well known name pointing out that
we're dealing with array in macro argument.

Also to be on a safe side prefix_name helper should
check the index been in bounds more precisely.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-03 23:17:21 +04:00
Cyrill Gorcunov
3b4e86b1dd preproc.c: Use list_ helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-02 20:31:53 +04:00
Cyrill Gorcunov
51fd86e0fe expand_mmac_params: Don't forget to handle TOK_OTHER
TOK_OTHER is legitime to follow TOK_PREPROC_ID so don't forget to handle it as well.

[ An addition to commit ec88c1beac ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-02 20:31:46 +04:00
Cyrill Gorcunov
ec88c1beac BR3005117: Expland local single macro before pasting tokens
When we have switched to unified token pasting code we loose
backward compatibility. Restore it.

Note that new code MUST not expluatate this facility but rather
use paste macro %+ explicitly.

N.B. this patch is probably the candidate for revert, though
to give it a chance I commit it.

Reported-by: Alexey Dokuchaev
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-06-02 01:05:37 +04:00
H. Peter Anvin
f237c71c0d New %use package "fp"
New standard macro package with utility macros for floating-point
constants.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-07 13:42:09 -07:00
H. Peter Anvin
19cbe0c1c4 nasmdoc: document octal/binary floating-point
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-07 13:21:20 -07:00
H. Peter Anvin
c8d8a13cde nasmdoc: add missing comma
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-07 13:14:45 -07:00
H. Peter Anvin
26bb8890ef nasmdoc: update the full set of numeric prefix/suffix characters.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-07 13:12:12 -07:00
H. Peter Anvin
62de275527 outobj: update error message
The possible sizes we can encounter are 1, 2, 4, 8... make sure we get
a proper error message.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06 17:58:46 -07:00
H. Peter Anvin
931ce775cf outobj: properly error on unsupported relocations
Error out on any relocations not supported by the backend.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06 17:52:57 -07:00
H. Peter Anvin
bce369022a outelf64: update copyright date
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06 17:45:39 -07:00
H. Peter Anvin
32575e46ac ELF support for 8-bit relocations
Support 8-bit relocations (OUT_ADDRESS and OUT_REL1ADR) in ELF.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06 16:14:00 -07:00
H. Peter Anvin
fea84d7fec Permit short intersegment jumps
Allow an intersegment jump to be short (OUT_REL1ADR) if explicitly
specified so by the user.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06 15:33:24 -07:00
H. Peter Anvin
55ae12052c Add support for one-byte relocations
Add OUT_REL1ADR (one-byte relative address) and support for
OUT_ADDRESs with size == 1.  Add support for it in
outbin and outdbg.  *It still needs to be added to other backends*,
both the OUT_REL*ADR and OUT_ADDRESS codepaths need to be handled.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-05-06 15:33:24 -07:00
Cyrill Gorcunov
97ec06a16a MachO: Fix misprinted macho_sectalign
macho_sectalign was occasionally misprinted
with macho_setcalign, fix it. No change on functionality.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-28 23:17:13 +04:00
Cyrill Gorcunov
a20b668add obj: Implement sectalign helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25 22:00:15 +04:00
Cyrill Gorcunov
573d25fe92 macho: Implement sectalign handler
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25 21:35:09 +04:00
Cyrill Gorcunov
9868bfe80f ieee: Fix section index match in sectalign handler
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25 17:55:52 +04:00
Cyrill Gorcunov
28e6136bee headers: Update year
It's 2010 now

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25 12:02:38 +04:00
Cyrill Gorcunov
b9fd67b38e outieee: Implement sectalign handler
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-25 01:17:11 +04:00
Cyrill Gorcunov
bb196d4fd3 outbin: Drop current_section variable
There is no need for it anymore.

Reported-by: "H. Peter Anvin" <hpa@linux.intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 22:32:17 +04:00
Cyrill Gorcunov
4c45e83aac outbin: Prune ancient format_mode variable
format_mode is always set to 1 so there is no need to
keep this variable. "Old chicken bit" (c) :)

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 22:25:55 +04:00
H. Peter Anvin
c138e6a4b2 ilog2: optimize use of bsr for x86-64
On x86-64 platforms, we can rely on BSR not changing the destination
operand when the input is zero.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-04-22 11:02:56 -07:00
H. Peter Anvin
671a19600c doc: use bouncer URLs for the ABI docs
MSDN can't seem to keep their URLs stable, so use bouncer links
that we can change if necessary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-04-22 10:50:51 -07:00
Cyrill Gorcunov
630f221b01 bin: Implement sectalign handler
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:06:29 +04:00
Cyrill Gorcunov
279d8f146a coff: Use IMAGE_SCN_ALIGN_MASK macro
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:06:14 +04:00
Cyrill Gorcunov
3834305507 coff: Allow alignment greater then 64 bytes on win
On win32/64 we have no 64 bytes limit so hit it on
"coff" target only.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:06:03 +04:00
Cyrill Gorcunov
7c8c258cdd coff: Fix section alignment computation
Section alignment is broken due to not being
direct "align -> power of two set" mapping but
rather including second addition operation.

Fix it by introducing coff_sectalign_flags helper.
This also allow us to use this helper for getting
rid of open coded computation as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:05:50 +04:00
Cyrill Gorcunov
42017a6115 coff: Use predefined macros instead of numbers and style fix
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:03:56 +04:00
Cyrill Gorcunov
641ca7fd6a ilog2: Use ROUND helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:03:39 +04:00
Cyrill Gorcunov
c8fd6fdae4 ilog2: Get rid of tabs
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:02:35 +04:00
Cyrill Gorcunov
557a57bd55 pecoff.h: Complete header
Put in all constants pecoff v8 states. Most probably we
will never need most of them but lets have them here for
completeness.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-22 19:02:22 +04:00
H. Peter Anvin
35c30da61b Remove open-coded ilog2() implementations
When we need integer log2, use the new library routine.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-21 16:46:57 -07:00
H. Peter Anvin
084b13227e Add generic ilog2 functions
Add ilog2_{32,64}() and alignlog2_{32,64}() ... the latter is intended
for alignment statements and return -1 for non-power-of-2 other than 0
(which returns 0).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-21 16:43:20 -07:00
H. Peter Anvin
34543131ca Makefile: clean up the lib directory on make clean
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-04-21 16:41:37 -07:00
Cyrill Gorcunov
900b2229e4 standard.mac: Update section alignment on align call
Achieved via sectalign call. Note that not all output
targets (ie formats) may handle sectalign yet, most
of them just ignore this entity.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 23:52:57 +04:00
Cyrill Gorcunov
83ffe8ca24 coff: Use predefined macro in common section flags
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 22:40:11 +04:00
Cyrill Gorcunov
d0c6dbe0fe coff: Use predefined macro and eliminate open coded constants
Not all are covered but process initiated.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-04-21 22:03:33 +04:00