Commit graph

102 commits

Author SHA1 Message Date
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