Commit Graph

275 Commits

Author SHA1 Message Date
H. Peter Anvin
70e6c2a6cb ELF64: GOT and PLT references need a symbol (a slot!) to reference
GOT and PLT references need a symbol; after all, they reference a GOT
or PLT slot.  Thus, they need elf_add_gsym_reloc().  Mungify the
interface so that they can communicate the need for the PC-shifted
offset into the relocation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 20:01:16 -07:00
H. Peter Anvin
8140afbaf1 ELF64: unbreak generating no-segment addresses
When generating an address that is *not* tied to a symbol, we just
want to emit the bytes.  I believe the assembler is already supposed
to do that for us, but just in case, do it right here too.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 19:32:10 -07:00
H. Peter Anvin
64fa04f019 ELF64: use the RELA addend field instead of relying on the code stream
The x86-64 ABI wants the symbol addend to reside in the addend field
of the RELA relocation, not in the code stream.  Apparently it's
something one can get away with, but the linker would still botch it
for some cases.  Change it so we pass the proper output and emit zero
into the code stream.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 18:23:29 -07:00
H. Peter Anvin
c3cea48430 ELF64: fix various GOT relocations
Try to make the various GOT relocations do the right thing in ELF64,
including erring out when appropriate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-15 15:23:18 -07:00
Charles Crayne
154f6f2380 Fix typo in previous outelf64.c commit
Stray line fragment left in when removing debug code.
2008-10-12 14:14:45 -07:00
Charles Crayne
cff8dc6d6b RIP rel relocations for PIC released for testing.
Expressions like
  mov	r15,[rel integer wrt ..got]
  lea   rax,[rel integer wrt ..gotoff]
now assemble correctly.

In addition, a fix has been made to the corresponding
abs relocations.

Both of these areas still need additional testing.
2008-10-12 14:00:11 -07:00
H. Peter Anvin
5618e0063d outaout.mac: aoutb is an alias for aout
aoutb is an alias format for aout (in the sense they use the same
macro set.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-09 09:53:20 -07:00
H. Peter Anvin
c357381da4 macros: win32 and win64 are COFF, not Mach-O
Somehow the win32 and win64 aliases got listed on Mach-O, not on
COFF.  This doesn't have any effect on the current code, but might in
the future.  Correct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-09 09:37:37 -07:00
H. Peter Anvin
fafb6a50e2 outcoff: stylistic cleanups
Don't use explicit L's for things which are really size_t; not only is
it unnecessarily ugly, but it's wrong in a lot of ways.  Do some other
minor stylistic cleanups.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-02 12:56:39 -07:00
H. Peter Anvin
c00c897df7 outcoff: default output symbols to T_NULL
We would leave the output symbol type uninitialized.  Explicitly
initialize it to zero (T_NULL, meaning no symbol type information),
since that's what was effectively done.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-02 12:55:35 -07:00
Slavik Gnatenko
1b67bd25b2 BR 2010180: outobj: Garbage may be written in a last PUBDEF
The testcase illustrates the problem. After "nasm -f obj
alonesym.nasm"
let's look to dump:

======
PUBDEF386(91) recnum:5, offset:0000005bh, len:03f9h, chksum:bbh(bb)
Group: 0, Seg: 1
00020000h - 'sym0000' Type:0
00020004h - 'sym0001' Type:0
....
00020134h - 'sym0077' Type:0

PUBDEF(90) recnum:6, offset:00000457h, len:000ah, chksum:b6h(b6)
Group: 0, Seg: 1
00000138h - 's' Type:2
0000b600h - '' Type:0
======

The problem is while 's' offset is 20138h it is marked as type 90h not
91h.  The root cause is located in obj_x():

static ObjRecord *obj_x(ObjRecord * orp, uint32_t val)
{
    if (orp->type & 1)
    	orp->x_size = 32;
    if (val > 0xFFFF)
        orp = obj_force(orp, 32);
    if (orp->x_size == 32)
        return (obj_dword(orp, val));
    orp->x_size = 16;
    return (obj_word(orp, val));
}

It sets up x_size and than writes data. In the testcase data are the
offset and this offset overflows a record. In this case the record is
emitted and its x_size is cleared. Because this is last PUBDEF the new
record with only 's' symbol is emitted also but its x_size is not 32
(it's still zero) so obj_fwrite doesn't switch to 91h type.

The problem seems to be very generic and expected to be occurred on
many other record types as well.

        ----

And the fix is simple:

if (orp->x_size == 32)
{
  ObjRecord * nxt = obj_dword(orp, val);
  nxt->x_size = 32; /* x_size is cleared when a record overflows */
  return nxt;
}
2008-07-19 19:27:41 -07:00
H. Peter Anvin
bda7a6e371 ctype.h: wrapper ctype functions with a cast to (unsigned char)
ctype functions take an *int*, which the user is expected to have
taken the input character from getc() and friends, or taken a
character and cast it to (unsigned char).

We don't care about EOF (-1), so use macros that cast to (unsigned
char) for us.
2008-06-21 10:23:17 -07:00
H. Peter Anvin
cfb7176ca2 Move the output format macros into the macros.pl mechanism
Move the handling of "extra" macros (i.e. output format macros) into
the macros.pl mechanism.  This allows us to change the format of the
internal macro store in the future - e.g. to a single byte store
without redundant pointers.

Also, stop using indicies into a long array when there is no good
reason to not just use different arrays.
2008-06-20 15:20:16 -07:00
Charles Crayne
842da0ad0b Correct X86_64 reference in dwarf support message 2008-06-11 16:15:01 -07:00
H. Peter Anvin
fcb8909749 Move all the RAA code out of nasmlib
The RAA code doesn't have to be in nasmlib; it is only used by nasm
itself, and is better handled in a separate module.
2008-06-09 17:40:16 -07:00
H. Peter Anvin
1803dedae8 Move all the SAA code out of nasmlib
Move all the SAA code out of nasmlib; it's not used by anything than
nasm itself.  Cleaning out the kitchen sink known as nasmlib is a good
thing, too.
2008-06-09 17:32:43 -07:00
H. Peter Anvin
c735d1a6b2 Replace the WSAA macros with functions
Change the WSAA macros into functions; reducing the icache footprint.
2008-06-08 21:15:01 -07:00
H. Peter Anvin
cb38f505e4 WSAA: make the WSAA macros contain their own buffer
Make the WSAA macros contain their own buffer definitions.  This
eliminates the need to have a separate "workbuf" declared in the
outelf backends, which isn't even used for anything else, except for a
few completely redundant strcpys.

Note: these macros probably should be replaced with actual
functions.  The overhead of the function call is likely to be more
than offset by lower icache footprint.
2008-06-08 18:39:55 -07:00
Charles Crayne
2d900f5488 Avoid obscure segfault in DWARF generation
If DWARF debugging info is requested, and no section
is marked executable, output empty debug sections,
instead of allowing assembler to segfault.
2008-06-05 16:12:06 -07:00
Andy Polyakov
082dbb471f outcoff.c: remove dead code, add check for imagerel
Remove commented-out (dead) code, add check that the imagerel
references are valid.
2008-05-27 14:01:25 -07:00
Andy Polyakov
94cd4dd113 Win64: IMAGEREL references (SEH support for Win64)
Guess what, SEH again, but in Win64 context, which is completely
different matter from Win32. At lowest level this one boils down to
putting so called imagerel references, or in practical terms
relocations of type ADDR32NB, 0x0003, into .pdata and .xdata
segments. Two possibilities. 1. implement say 'wrt ..imagerel' or 'wrt
..imagebase'. 2. silently enforce ADDR32NB relocations in .pdata and
.xdata segments.
2008-05-23 19:45:39 -07:00
H. Peter Anvin
45b7431a0c Make SAFESEH syntax error ERR_NONFATAL
Incorrect use of SAFESEH is more suited for ERR_NONFATAL than ERR_FATAL
2008-05-23 18:38:51 -07:00
Andy Polyakov
4401cc79a2 Support for Win32 safeseh (BR 195417)
This is basically not a bug report, but a feature request.

It's desired to be able to link .obj modules compiled with 'nasm -f
win32' with Microsoft 'link /safeseh'. As well as to register symbols
(commonly subroutine's entry points or even external symbols) as "safe
handlers." In order to achieve this, several points are required.

First of all, object module has to have absolute symbol named @feat.00
with value of 1. This can actually be achived by adding 'absolute 1'
and '@feat.00:' to source code, but it's desirable that it's
autogenerated for win32 modules.

Handler registration is essentially symbol's *index* in current
module's symbol table in .sxdata, segment with 0x200 segment flags, an
"info" segment. It's also essential that symbol has type 0x20 (see
below). All this is depicted in following framgents of 'objdump -xD'
output:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .sxdata       00000004  00000000  00000000  0000003c  2**2
                  CONTENTS, READONLY, DEBUGGING

SYMBOL TABLE:
...
[  5](sec -1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000001 @feat.00
[  6](sec  0)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000000 _handler
...
<.sxdata>
0: 06 00 00 00

Note [6] and (ty 20) in _handle line in SYMBOL TABLE. "06 00 00 00" in
.sxdata is little-endian 6, _handler's index. This is what makes up
"registration." It's impossible to achieve this with current nasm
facilities and it's probably appropriate to introduce a directive for
it, 'safeseh _handler' is probably most natural choice.
2008-05-23 18:37:52 -07:00
H. Peter Anvin
72ec0e4144 Temporaries in macros need a unique prefix; WSAA*() macros to header
When using temporaries in macros, given them a unique prefix to avoid
namespace collisions when using one macro inside another.

Move the WSAA*() macros from outelf32/outelf64 to a separate header
file.
2008-04-10 14:56:09 -07:00
Charles Crayne
6f15b9884e Correctly identify dwarf support for elf32
Change architecture tag to i386.
2008-04-07 13:15:53 -07:00
Charles Crayne
aed5cfea58 Adjust symbol number for global symbols
Reloc entries were pointing to wrong target section
2008-03-04 14:25:34 -08:00
Charles Crayne
90131d500b Report dwarf as V2 for ELF32
Older versions of gdb reject version 3
2008-02-24 21:05:46 -08:00
Charles Crayne
225f82fa12 Dwarf3 support for ELF32
1. Port dwarf3 support from ELF64 to ELF32
2. Move common SAA extentions to nasmlib
2008-02-24 19:14:17 -08:00
Charles Crayne
986312b17a Dwarf support tweeks and clean-up
1. Add relocation entries for dwarf sections.
2. Combine common dwarf and stabs routines.
2008-02-23 18:35:11 -08:00
H. Peter Anvin
338a3b6882 Clear up WRITE macros causing compile failures with Watcom
The OpenWatcom compiler warns about invalid shifts (correctly, it
appears) due to the non-X86_MEMORY versions of the various WRITE
macros.  Fix.
2008-02-16 15:25:02 -08:00
Charles Crayne
f0b43d212e Upgrade dwarf3 support for elf64
Add support for multiple executable segments
2008-02-13 19:58:54 -08:00
Charles Crayne
978a25d3e9 Test version of dwarf debugging format for elf64
Not ready for prime time, but anyone who is interested
is welcome to help me test.
2008-02-06 22:17:55 -08:00
Charles Crayne
f3d2d41e06 Prevent segfault in stabs64_typevalue
Prevent segfault when type == STT_OBJECT and no symbol
has been defined.
2008-01-27 12:49:20 -08:00
Charles Crayne
730d6f821a Increase GLOBAL_TEMP_BASE
Increase GLOBAL_TEMP_BASE from 4096 to 1048576
2008-01-16 18:38:48 -08:00
Charles Crayne
4acfb4f44e Temporary fix for large number of sections
Increase GLOBAL_TEMP_BASE TO 4096
2008-01-11 17:22:19 -08:00
Beroset
095e6a2973 regularized spelling of license to match name of LICENSE file 2007-12-29 09:44:23 -05:00
Charles Crayne
116994111b Fix elf vs elf32 stabs generation bug
When invoked as -f elf -g, stabs info was not being generated.
2007-11-30 16:23:56 -08:00
H. Peter Anvin
682221438e Clean up remaining build warnings
Clean up remaining build warnings.  None of this should affect code
operations.  The only warnings which were actually relevant might have
been the ones in ldrdf.c, but it's not clear if anyone ever uses that.
2007-11-18 22:18:09 -08:00
H. Peter Anvin
604a3f4e21 outbin.c: fix one missed change from type -> size
Fix one missed change from "type" to "size".  May want to look through
all the other backends as well for similar issues.

This would generate the wrong section lengths, with obviously bad results.
2007-11-15 10:24:55 -08:00
root
dbb1828ad5 Support setting OSABI value in ELF header. 2007-11-13 19:52:54 -08:00
H. Peter Anvin
4095197f6c Cast 64-bit switch expressions to (int) to keep OpenWatcom happy
Our size arguments are 64-bit values, but we don't need that range for
anywhere where we need a switch.  OpenWatcom can't deal with them
(sigh), so cast them to (int) for now.
2007-11-13 09:49:51 -08:00
H. Peter Anvin
d1fb15c154 Address data is int64_t; simplify writing an address object
Address data is always int64_t even if the size itself is smaller;
this was broken on bigendian hosts (still need testing!)

Create simple "write sized object" macros.
2007-11-13 09:37:59 -08:00
H. Peter Anvin
fb0c90cdbe BR 1709392: Fix alignment handling in Mach-O format
Fix alignment handling in the Mach-O format.  The patch is from the
bug report, mangled to apply to the current source base.  I have no
way to test this, so I'm going to have to assume it's correct.
2007-11-12 22:11:46 -08:00
Charles Crayne
2321d930ec Clean up a few more 32-bit bottlenecks 2007-11-10 17:52:23 -08:00
H. Peter Anvin
34f6fb0a65 Don't combine type and size into a single argument
Don't combine type and size into a single argument; *every* backend
immediately breaks them apart, so it's really just a huge waste of
effort.  Additionally, it avoids using short immediates in the
resulting code, which is a bad thing.
2007-11-09 14:44:02 -08:00
H. Peter Anvin
44d7dcf87b Fix building under OpenWatcom
OpenWatcom doesn't like 64-bit switch arguments; the change to 64-bit
type arguments caused that to happen in outmacho.c.  Hack around it
for now; however, realistically speaking the whole bit stealing thing
is probably a bad idea, especially since virtually all CPUs handle
short immediates better than long ones.
2007-11-08 20:43:22 -08:00
Charles Crayne
8c7eca4936 Pass 64-bit instruction lengths to back-ends. 2007-11-06 21:48:12 -08:00
Charles Crayne
4e8563d5c4 Upgrade label functions to 64-bit 2007-11-05 17:19:32 -08:00
Charles Crayne
d1cf2de1c0 Adjust stabs symbol index to match symbol table.
Add data length info to symbol table when stabs is active.
2007-10-28 15:29:54 -07:00
Charles Crayne
b0e1d423dd Clean up elf symbol table section 2007-10-21 14:21:43 -07:00
H. Peter Anvin
7065309739 Formatting: kill off "stealth whitespace"
"Stealth whitespace" makes it harder to read diffs, and just generally
cause unwanted weirdness.  Do a source-wide pass to get rid of it.
2007-10-19 14:42:29 -07:00
root
2674b04d88 Avoid unnecessary warning on redefinition of section (bug 801180) 2007-10-18 17:04:10 -07:00
Charles Crayne
f23a5b042c Generate stabs entries for any executable section 2007-10-17 17:55:45 -07:00
H. Peter Anvin
51cbf4a1fa More "bool" fixes
A few more variables passed as pointers which are now defined as bool *.
2007-10-11 10:12:58 -07:00
H. Peter Anvin
70055964fc Additional uses of bool and enum
Proper use of bool and enum makes code easier to debug.  Do more of
it.  In particular, we really should stomp out any residual uses of
magic constants that aren't enums or, in some cases, even #defines.
2007-10-11 00:05:57 -07:00
H. Peter Anvin
6867acc18e Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C
requires <stdbool.h> for this, in C++ it is an inherent type built
into the compiler.  Use those instead of the old macros; emulate with
a simple typedef enum if unavailable.
2007-10-10 14:58:45 -07:00
H. Peter Anvin
fe501957c0 Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)

Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
2007-10-02 21:53:51 -07:00
H. Peter Anvin
10ba8490ce outcoff: set the "virtual size field" to zero (BR 1351586)
Per SF bug report 1351586:

The COFF spec suggests that the "Virtual Size" field (which
immediately follows the name field inside a section header) be set to
0 for an object file.

By contrast (as documented in comment #4 at the beginning of its
outcoff.c file) NASM sets it to a particular non-0 value.

MASM 6.15 matches NASM for both 16- and 32-bit object files,
i.e. emits non-0 values.

MASM 8 (from VS 2005 Beta) matches the COFF spec for 64-bit object
files, i.e. emits 0.

GAS matches the COFF spec for 32-bit object files (MinGW or Cygwin),
i.e. also emits 0.

Older versions of GNU ld seem to honor said "Virtual Size" field
whereas newer versions do not.  As a result those older versions
generate "bloated" image files.

Since the COFF spec and the real world seem to disagree for this case,
it might make sense to add a method for selecting between the two to
NASM.

Date: 2005-11-28 15:39
Sender: nasm64developer
Logged In: YES
user_id=804543

MASM 8 (from VS 2005 Beta) also matches the COFF spec for 16- and
32-bit object files, i.e. emits 0.

That said, NASM should always emit 0 too. Therefore I am turning this
from a support request into a bug.
2007-09-24 17:02:41 -07:00
Frank Kotler
577f5ea592 Merge branch 'master' of git+ssh://fbkotler@repo.or.cz/srv/git/nasm 2007-09-19 01:34:55 -04:00
H. Peter Anvin
9b0d41ddd4 elf64: fix 32-bit truncations
Fix 32-bit truncations, as evidenced by the following test program:

    mov rax, 8080808080808080h
2007-09-18 22:22:49 -07:00
Frank Kotler
24196047b5 add "const" to output/outdbg.c
apparently we missed that when updating "const" in other files
2007-09-18 02:06:09 -04:00
H. Peter Anvin
21d6be423f Minor fixes needed to compile with MSVC++ 2005
Minor fixes to make it possible to compile with MS Visual C++ 2005.
Unfortunately, MSVC++ is not fully C99 compliant; in particular, it
doesn't handle interspersed declarations and other code.  Furthermore,
it chokes on some expressions in outelf64.c, which fortunately can be
easily substituted with simpler expressions.
2007-09-16 22:15:34 -07:00
Chuck Crayne
199b96a810 Provide 64-bit support for ORG directive 2007-09-04 01:29:43 +00:00
H. Peter Anvin
74cc5e569c Finishing touches on perfect hash tokenizer; actually turn the thing on
Finish the perfect hash tokenizer, and actually enable it.

Move stdscan() et al to a separate file, since it's not needed in any
of the clients of nasmlib other than nasm itself.

Run make alldeps.
2007-08-30 22:35:34 +00:00
H. Peter Anvin
b838bcfe9f Generate R_X86_64_64 relocations in elf64 output
When appropriate, generate R_X86_64_64 relocations in elf64 output.
2007-08-29 18:20:19 +00:00
Frank Kotler
7fcda399cd add nasm_strsep to nasmlib, for output/outmacho.c - strtok doesn't work 2007-08-26 05:48:54 +00:00
Frank Kotler
155eef6a3d finally commit Mike Frysinger's "elf-visibility" patch 2007-08-26 05:10:24 +00:00
H. Peter Anvin
90b9417613 16-bit relocations are standard in ELF64 (at my request, incidentally) 2007-05-04 18:47:16 +00:00
Chuck Crayne
8ab0320f02 Clarify comments about relocation entries. 2007-04-29 20:57:53 +00:00
Chuck Crayne
1c270b7fe2 Allow ELF32 to be invoked either as -f elf or -f elf32 2007-04-29 00:28:24 +00:00
Chuck Crayne
6e61733e38 Eliminate shift count warnings when building on 32-bit systems
Remove define for DEBUG
2007-04-28 22:18:04 +00:00
Chuck Crayne
26d3de3217 Initial support for ELF64 2007-04-28 06:18:48 +00:00
Keith Kanios
7295e9856d Fixed RDF/2 to comply with "maxbits" use. 2007-04-18 02:24:34 +00:00
H. Peter Anvin
f4ba92577e outmacho.c: stylistic cleanups
- No need to cast (int32_t)NULL for a sentinel; just write 0.
- Fix weird formatting of a structure.
- Remove redundant parantheses.
2007-04-14 08:03:02 +00:00
Keith Kanios
c8ef68bba9 Hopefully it is actually fixed this time :P 2007-04-14 03:44:31 +00:00
Keith Kanios
3e7bb1e046 Fixed structure initialization issue. 2007-04-14 01:49:07 +00:00
Keith Kanios
a2e9b953f8 Refixed uninitialized data. 2007-04-14 01:44:35 +00:00
Keith Kanios
df12db1f13 Fixed uninitialized structure data. 2007-04-14 01:40:24 +00:00
Keith Kanios
c7ae18dba1 Placated unreferenced types. 2007-04-14 00:46:25 +00:00
Keith Kanios
93f2e9a5a1 c99 printf/fprintf compliance. 2007-04-14 00:10:59 +00:00
Keith Kanios
8b2a72881c Fixed obj_fwrite() declaration to match "static" definition. 2007-04-13 22:07:53 +00:00
Keith Kanios
68d52b7737 Added appropriate "void" prototypes. 2007-04-13 22:03:24 +00:00
Keith Kanios
2a3311b546 Replaced str(n)casecmp with more standard str(n)icmp. 2007-04-13 22:00:42 +00:00
H. Peter Anvin
c1494ac5ab Macroize any compiler-specific code; macros defined in "compiler.h"
Move anything compiler-specific to "compiler.h".

There was an unguarded use of __attribute__(()) in outmacho.c; also
require gcc 4+ for __builtin_ctlz().  Speed up the open-coded version, too.
2007-04-13 19:58:42 +00:00
Keith Kanios
a6dfa78b78 Fixed distinction between char and int8_t data types. 2007-04-13 16:47:53 +00:00
Keith Kanios
c1c5a2d96f Fixed c99 data-types after removal of typedefs. 2007-04-13 00:52:54 +00:00
H. Peter Anvin
038d861ede Remove obsolete types; add <inttypes.h> where needed; header fixes
- Remove obsolete types like "uint32"; use "uint32_t" consistently.
- Make sure we include <inttypes.h> where needed.
- Header file guards should be FOO_H or SUBDIR_FOO_H; _FOO_H infringes
  on the C implementation's namespace and should only be used when
  writing libc!
- Change a few "int8_t" back to "char" where appropriate.  There are
  a lot more places where that should be done, though.
- Clean up the check for getuid/getgid in rdoff/rdlar.h.
2007-04-12 16:54:50 +00:00
H. Peter Anvin
58421f9697 outmacho.c: Don't assume __builtin_ctzl exists for gcc < 4
__builtin_ctzl exists for all architectures on gcc 4, but not for all
versions of gcc 3 and lower.  For simplicity, make the cutoff gcc 4.
2007-04-12 16:12:09 +00:00
Keith Kanios
b7a89544d0 General push for x86-64 support, dubbed 0.99.00. 2007-04-12 02:40:54 +00:00
Eric Christopher
a5f0000db0 2006-02-02 Eric Christopher <echristo@apple.com>
Wade Tregaskis  <wtregaskis@apple.com>

	* output/outmacho.c (macho_cleanup): Depend on symbols
	existing.
2006-02-02 21:50:47 +00:00
Eric Christopher
5eb2d2b094 2005-12-08 Wade Tregaskis <wtregaskis@apple.com>
* nasm/nasm/output/outmacho.c (struct section): Added "align" field.
	(sectmap): Added ".rodata" section.
	(exact_log2): New.
	(macho_section): Added support for section attributes.
        "align=" and "data" specifically.
	(macho_write_segment): Write out section alignment to Mach-O file.
2005-12-09 00:27:26 +00:00
Eric Christopher
5547e191fe 2005-12-05 Eric Christopher <echristo@apple.com>
* nasm/nasm/output/outmacho.c (macho_write_section): Don't add
        section offset to the symbol to be relocated.
        (add_reloc): Update comment.
2005-12-05 23:17:17 +00:00
Eric Christopher
a485fbdd37 Added section attributes, in particular S_ATTR_SOME_INSTRUCTIONS and update .text.
Change symbols from saa to explicitly allocated.
macho_layout_symbols: new function to sort symbols and renumber.
adjust symtab output accordingly
fixup relocs after renumbering
add relocation debugging routines.
2005-10-07 22:30:56 +00:00
Eric Christopher
d3179b6ce0 Break macho_cleanup into separate functions. 2005-09-26 22:13:42 +00:00
Eric Christopher
5508a4c7fc Run misc/Nindent on outmacho.c 2005-09-22 21:41:17 +00:00
Eric Christopher
1b8a72ae7c Add basic support for Mach-O file format. 2005-09-22 21:22:33 +00:00
Frank Kotler
f3071da71e fix outobj.c bug - every 256th extern crashed nasm
-
2005-06-08 16:41:10 +00:00
Frank Kotler
02f05cebba Jindrich Novy's buffer overrun patch to outieee.c
-
2005-05-09 16:34:43 +00:00
H. Peter Anvin
e2c80181b6 Apply Nindent to all .c and .h files 2005-01-15 22:15:51 +00:00
Yuri Zaporogets
e0c059ab4e outrdf2.c now uses the same definitions of RDOFF2 format that RDOFF utils.
Export/import/common label size is increased from 33 to 64. Fixed the bug
that caused wrong behavior of rdfgetheaderrec() if label length was 32.
Changed error codes from numeric values to symbolic constants.
Moved some routines from rdfdump.c to rdoff.c. They will be utilized also
by rdfdisasm, which is being developed.
2004-09-15 06:54:34 +00:00
Frank Kotler
7c4dada951 fix as86 .bss handling per John Coffman's patch 2004-04-25 02:57:00 +00:00
Frank Kotler
b4a1735c47 Update rdoff 2003-12-12 06:18:07 +00:00
Stanislav Karchebny
d52236c00e Revert erroneous macro added and modify __OUTPUT_FORMAT__ to a string const 2003-09-25 11:43:28 +00:00
Stanislav Karchebny
5e8f36611f Consistency fix 2003-09-25 11:28:45 +00:00
Stanislav Karchebny
88a049aca1 Added _NASM_FORMAT_ macro 2003-09-24 10:30:56 +00:00
H. Peter Anvin
97b7e0a23a Fix list iterator 2003-09-12 20:49:25 +00:00
H. Peter Anvin
bb88d011e3 If we don't specify -g, actually suppress debugging output 2003-09-10 23:34:23 +00:00
Frank Kotler
243a37719b nasm_malloc-ize Martin's outelf.c stabs stuff 2003-09-06 05:48:16 +00:00
H. Peter Anvin
61ecdbb3a8 First attempt at fixing the stabs/ELF issue. 2003-09-06 00:50:27 +00:00
H. Peter Anvin
2b320bcab9 Restore the adjusted symbol id start 2003-07-10 00:40:33 +00:00
H. Peter Anvin
73320328c1 Generate stabs format debugging info for ELF 2003-07-09 19:11:10 +00:00
H. Peter Anvin
da4c3983b2 Quiet spurious gcc warning 2003-07-09 19:10:47 +00:00
Michael K. Ter Louw
fbf539dbd9 start/vstart/align/valign can now be >0x80000000 2003-07-09 08:10:22 +00:00
Frank Kotler
d9119b2e52 Fixed outbin.c to allow origin > 80000000h 2003-06-30 20:39:23 +00:00
Frank Kotler
6b8350cdea Mike's multisection outbin.c "align bug fix" 2003-02-04 07:11:20 +00:00
Frank Kotler
f17039406f Yuri's 12/3/2002 rdoff patches- 2002-12-04 00:49:37 +00:00
H. Peter Anvin
c9f57c24d0 Fixes from Bart Oldeman 2002-09-19 04:27:01 +00:00
H. Peter Anvin
bfebdb0a07 "const"-ipation fixes from Trevor Woerner 2002-09-12 02:23:54 +00:00
H. Peter Anvin
059647580c This is Jim's outcoff patch. 2002-06-07 20:42:22 +00:00
H. Peter Anvin
8215a54b21 Fix off-by-one error found when running theowl's test cases. 2002-05-26 23:48:09 +00:00
H. Peter Anvin
77a036e213 Make .rodata a recognized ELF section with default attributes 2002-05-17 04:51:10 +00:00
H. Peter Anvin
0a7a3b459c Change "const static" -> "static const" to keep gcc happy 2002-05-14 23:54:46 +00:00
H. Peter Anvin
310b3e165f Code cleanup fixes from Ed Beroset 2002-05-14 22:38:55 +00:00
H. Peter Anvin
8ff796d817 Fix from John Coffman to 16-bit OBJ format output. 2002-05-09 05:35:23 +00:00
H. Peter Anvin
8ac364139a NASM 0.98.30 2002-04-30 21:09:12 +00:00