macho64: Manually merge macho64 branch with master branch.

This commit is contained in:
Keith Kanios 2009-07-08 23:04:52 -05:00
parent 745560e65a
commit 6d0d0d2736
5 changed files with 1594 additions and 25 deletions

View File

@ -67,10 +67,10 @@ NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \
output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
preproc.$(O) quote.$(O) pptok.$(O) macros.$(O) \
listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) strfunc.$(O) \
tokhash.$(O) regvals.$(O) regflags.$(O)
output/outdbg.$(O) output/outieee.$(O) output/outmacho32.$(O) \
output/outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O)
NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
@ -312,9 +312,12 @@ output/outieee.$(O): output/outieee.c compiler.h config.h insnsi.h nasm.h \
nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h
output/outlib.$(O): output/outlib.c compiler.h config.h insnsi.h nasm.h \
nasmlib.h output/outlib.h pptok.h preproc.h regs.h
output/outmacho.$(O): output/outmacho.c compiler.h config.h insnsi.h nasm.h \
nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h regs.h \
saa.h
output/outmacho32.$(O): output/outmacho32.c compiler.h config.h insnsi.h \
nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
regs.h saa.h
output/outmacho64.$(O): output/outmacho64.c compiler.h config.h insnsi.h \
nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
regs.h saa.h
output/outobj.$(O): output/outobj.c compiler.h config.h insnsi.h nasm.h \
nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h \
stdscan.h

View File

@ -133,8 +133,11 @@
#ifndef OF_IEEE
#define OF_IEEE
#endif
#ifndef OF_MACHO
#define OF_MACHO
#ifndef OF_MACHO32
#define OF_MACHO32
#endif
#ifndef OF_MACHO64
#define OF_MACHO64
#endif
#ifndef OF_DBG
#define OF_DBG
@ -191,8 +194,11 @@
#ifndef OF_IEEE
#define OF_IEEE
#endif
#ifndef OF_MACHO
#define OF_MACHO
#ifndef OF_MACHO32
#define OF_MACHO32
#endif
#ifndef OF_MACHO64
#define OF_MACHO64
#endif
#endif
@ -233,8 +239,11 @@
#ifdef OF_NO_IEEE
#undef OF_IEEE
#endif
#ifdef OF_NO_MACHO
#undef OF_MACHO
#ifdef OF_NO_MACHO32
#undef OF_MACHO32
#endif
#ifdef OF_NO_MACHO64
#undef OF_MACHO64
#endif
#ifdef OF_NO_DBG
#undef OF_DBG
@ -264,7 +273,9 @@ extern struct ofmt of_win32;
extern struct ofmt of_win64;
extern struct ofmt of_rdf2;
extern struct ofmt of_ieee;
extern struct ofmt of_macho32;
extern struct ofmt of_macho;
extern struct ofmt of_macho64;
extern struct ofmt of_dbg;
struct ofmt *drivers[] = {
@ -307,8 +318,12 @@ struct ofmt *drivers[] = {
#ifdef OF_IEEE
&of_ieee,
#endif
#ifdef OF_MACHO
&of_macho,
#ifdef OF_MACHO32
&of_macho32,
&of_macho,
#endif
#ifdef OF_MACHO64
&of_macho64,
#endif
#ifdef OF_DBG
&of_dbg,

View File

@ -31,7 +31,7 @@
;;
;; --------------------------------------------------------------------------
OUT: macho
OUT: macho macho32 macho64
%define __SECT__ [section .text]
%macro __NASM_CDecl__ 1
%endmacro

View File

@ -54,7 +54,7 @@
#include "output/outform.h"
#include "output/outlib.h"
#if defined(OF_MACHO)
#if defined(OF_MACHO32)
/* Mach-O in-file header structure sizes */
#define MACHO_HEADER_SIZE (28)
@ -1020,13 +1020,13 @@ static void macho_write_section (void)
of the rest of the address. */
if (!r->ext) {
/* generate final address by section address and offset */
for (s2 = sects, fi = 1;
s2 != NULL; s2 = s2->next, fi++){
if(fi == r->snum){
l += s2->addr;
break;
}
}
for (s2 = sects, fi = 1;
s2 != NULL; s2 = s2->next, fi++) {
if (fi == r->snum) {
l += s2->addr;
break;
}
}
}
/* write new offset back */
@ -1335,8 +1335,26 @@ static void debug_section_relocs (struct section *s)
}
}
struct ofmt of_macho32 = {
"NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (i386) object files",
"macho32",
0,
null_debug_arr,
&null_debug_form,
macho_stdmac,
macho_init,
macho_setinfo,
macho_output,
macho_symdef,
macho_section,
macho_segbase,
macho_directive,
macho_filename,
macho_cleanup
};
struct ofmt of_macho = {
"NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X object files",
"MACHO (short name for MACHO32)",
"macho",
0,
null_debug_arr,

1533
output/outmacho64.c Normal file

File diff suppressed because it is too large Load Diff