Invoke aout N_* macros with pointer to struct internal_exec

No functional changes here.

BTW, some of these headers don't seem to be used anywhere:
include/aout/dynix3.h, include/aout/encap.h, include/aout/hp.h,
gas/config/aout_gnu.h

bfd/
	* aout-adobe.c: Invoke aout N_* macros with pointer to
	struct internal_exec.
	* aout-arm.c: Likewise.
	* aout-cris.c: Likewise.
	* aout-target.h: Likewise.
	* aout-tic30.c: Likewise.
	* aoutf1.h: Likewise.
	* aoutx.h: Likewise.
	* bout.c: Likewise.
	* freebsd.h: Likewise.
	* gen-aout.c: Likewise.
	* hp300hpux.c: Likewise.
	* i386aout.c: Likewise.
	* i386linux.c: Likewise.
	* i386lynx.c: Likewise.
	* i386mach3.c: Likewise.
	* i386os9k.c: Likewise.
	* libaout.h: Likewise.
	* m68klinux.c: Likewise.
	* m88kmach3.c: Likewise.
	* mipsbsd.c: Likewise.
	* netbsd.h: Likewise.
	* pc532-mach.c: Likewise.
	* pdp11.c: Likewise.
	* riscix.c: Likewise.
	* sparclinux.c: Likewise.
	* sparclynx.c: Likewise.
gas/
	* config/aout_gnu.h: Invoke aout N_* macros with pointer to
	struct internal_exec.
include/
	* bout.h: Invoke aout N_* macros with pointer to
	struct internal_exec.
	* os9k.h: Likewise.
include/aout/
	* adobe.h: Invoke aout N_* macros with pointer to
	struct internal_exec.
	* aout64.h: Likewise.
	* dynix3.h: Likewise.
	* encap.h: Likewise.
	* hp.h: Likewise.
	* hp300hpux.h: Likewise.
	* sun4.h: Likewise.
This commit is contained in:
Alan Modra
2015-12-01 11:40:52 +10:30
parent b560e2acdd
commit bbb1afc89b
40 changed files with 388 additions and 336 deletions

View File

@ -1,3 +1,33 @@
2015-12-01 Alan Modra <amodra@gmail.com>
* aout-adobe.c: Invoke aout N_* macros with pointer to
struct internal_exec.
* aout-arm.c: Likewise.
* aout-cris.c: Likewise.
* aout-target.h: Likewise.
* aout-tic30.c: Likewise.
* aoutf1.h: Likewise.
* aoutx.h: Likewise.
* bout.c: Likewise.
* freebsd.h: Likewise.
* gen-aout.c: Likewise.
* hp300hpux.c: Likewise.
* i386aout.c: Likewise.
* i386linux.c: Likewise.
* i386lynx.c: Likewise.
* i386mach3.c: Likewise.
* i386os9k.c: Likewise.
* libaout.h: Likewise.
* m68klinux.c: Likewise.
* m88kmach3.c: Likewise.
* mipsbsd.c: Likewise.
* netbsd.h: Likewise.
* pc532-mach.c: Likewise.
* pdp11.c: Likewise.
* riscix.c: Likewise.
* sparclinux.c: Likewise.
* sparclynx.c: Likewise.
2015-12-01 Alan Modra <amodra@gmail.com> 2015-12-01 Alan Modra <amodra@gmail.com>
* coff-rs6000.c (_bfd_xcoff_put_symbol_name): Replace abfd param * coff-rs6000.c (_bfd_xcoff_put_symbol_name): Replace abfd param

View File

@ -86,8 +86,8 @@ aout_adobe_callback (bfd *abfd)
bfd_set_arch_mach (abfd, bfd_arch_unknown, 0L); bfd_set_arch_mach (abfd, bfd_arch_unknown, 0L);
/* The positions of the string table and symbol table. */ /* The positions of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
/* Suck up the section information from the file, one section at a time. */ /* Suck up the section information from the file, one section at a time. */
for (;;) for (;;)
@ -166,12 +166,12 @@ aout_adobe_callback (bfd *abfd)
switch (ext->e_type[0]) switch (ext->e_type[0])
{ {
case N_TEXT: case N_TEXT:
sect->rel_filepos = N_TRELOFF (*execp); sect->rel_filepos = N_TRELOFF (execp);
sect->reloc_count = execp->a_trsize; sect->reloc_count = execp->a_trsize;
break; break;
case N_DATA: case N_DATA:
sect->rel_filepos = N_DRELOFF (*execp); sect->rel_filepos = N_DRELOFF (execp);
sect->reloc_count = execp->a_drsize; sect->reloc_count = execp->a_drsize;
break; break;
@ -213,7 +213,7 @@ aout_adobe_object_p (bfd *abfd)
If the environment variable GNUTARGET is set to "a.out.adobe", we will If the environment variable GNUTARGET is set to "a.out.adobe", we will
take just about any a.out file as an Adobe a.out file. FIXME! */ take just about any a.out file as an Adobe a.out file. FIXME! */
if (N_BADMAG (anexec)) if (N_BADMAG (&anexec))
{ {
targ = getenv ("GNUTARGET"); targ = getenv ("GNUTARGET");
if (targ && !strcmp (targ, aout_adobe_vec.name)) if (targ && !strcmp (targ, aout_adobe_vec.name))
@ -333,14 +333,14 @@ aout_adobe_write_object_contents (bfd *abfd)
/* Now write out reloc info, followed by syms and strings. */ /* Now write out reloc info, followed by syms and strings. */
if (bfd_get_symcount (abfd) != 0) if (bfd_get_symcount (abfd) != 0)
{ {
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET) if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (exec_hdr (abfd))), SEEK_SET)
!= 0) != 0)
return FALSE; return FALSE;
if (! aout_32_write_syms (abfd)) if (! aout_32_write_syms (abfd))
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*exec_hdr (abfd))), SEEK_SET) if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (exec_hdr (abfd))), SEEK_SET)
!= 0) != 0)
return FALSE; return FALSE;
@ -349,7 +349,7 @@ aout_adobe_write_object_contents (bfd *abfd)
if (!aout_32_squirt_out_relocs (abfd, sect)) if (!aout_32_squirt_out_relocs (abfd, sect))
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*exec_hdr (abfd))), SEEK_SET) if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (exec_hdr (abfd))), SEEK_SET)
!= 0) != 0)
return FALSE; return FALSE;
@ -377,7 +377,7 @@ aout_adobe_set_section_contents (bfd *abfd,
{ {
/* Assign file offsets to sections. Text sections are first, and /* Assign file offsets to sections. Text sections are first, and
are contiguous. Then data sections. Everything else at the end. */ are contiguous. Then data sections. Everything else at the end. */
section_start = N_TXTOFF (ignore<-->me); section_start = N_TXTOFF (0);
for (sect = abfd->sections; sect; sect = sect->next) for (sect = abfd->sections; sect; sect = sect->next)
{ {

View File

@ -34,7 +34,7 @@
: ((N_MAGIC (x) != ZMAGIC) \ : ((N_MAGIC (x) != ZMAGIC) \
? (bfd_vma) 0 \ ? (bfd_vma) 0 \
: ((N_SHARED_LIB (x)) \ : ((N_SHARED_LIB (x)) \
? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ ? ((x)->a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \
: (bfd_vma) TEXT_START_ADDR))) : (bfd_vma) TEXT_START_ADDR)))
#define TEXT_START_ADDR 0x8000 #define TEXT_START_ADDR 0x8000
@ -43,10 +43,10 @@
#define DEFAULT_ARCH bfd_arch_arm #define DEFAULT_ARCH bfd_arch_arm
#define MY(OP) CONCAT2 (arm_aout_,OP) #define MY(OP) CONCAT2 (arm_aout_,OP)
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ #define N_BADMAG(x) ((((x)->a_info & ~007200) != ZMAGIC) && \
(((x).a_info & ~006000) != OMAGIC) && \ (((x)->a_info & ~006000) != OMAGIC) && \
((x).a_info != NMAGIC)) ((x)->a_info != NMAGIC))
#define N_MAGIC(x) ((x).a_info & ~07200) #define N_MAGIC(x) ((x)->a_info & ~07200)
#define MY_bfd_reloc_type_lookup arm_aout_bfd_reloc_type_lookup #define MY_bfd_reloc_type_lookup arm_aout_bfd_reloc_type_lookup
#define MY_bfd_reloc_name_lookup arm_aout_bfd_reloc_name_lookup #define MY_bfd_reloc_name_lookup arm_aout_bfd_reloc_name_lookup

View File

@ -37,7 +37,7 @@
after text, but with those, we don't have any choice besides reading after text, but with those, we don't have any choice besides reading
symbol info, and luckily there's no pressing need for correctness for symbol info, and luckily there's no pressing need for correctness for
those vma:s at this time. */ those vma:s at this time. */
#define N_TXTADDR(x) ((x).a_entry & ~(bfd_vma) 0xffff) #define N_TXTADDR(x) ((x)->a_entry & ~(bfd_vma) 0xffff)
/* If you change this to 4, you can not link to an address N*4+2. */ /* If you change this to 4, you can not link to an address N*4+2. */
#define SEGMENT_SIZE 2 #define SEGMENT_SIZE 2
@ -93,8 +93,8 @@ static bfd_boolean MY (set_sizes) (bfd *);
not call set_sizes. */ not call set_sizes. */
#define MY_set_arch_mach NAME (aout, set_arch_mach) #define MY_set_arch_mach NAME (aout, set_arch_mach)
#define SET_ARCH_MACH(BFD, EXEC) \ #define SET_ARCH_MACH(BFD, EXECP) \
MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXEC)) MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXECP))
/* These macros describe the binary layout of the reloc information we /* These macros describe the binary layout of the reloc information we
use in a file. */ use in a file. */
@ -129,9 +129,9 @@ MY (write_object_contents) (bfd *abfd)
/* Setting N_SET_MACHTYPE and using N_SET_FLAGS is not performed by /* Setting N_SET_MACHTYPE and using N_SET_FLAGS is not performed by
the default definition. */ the default definition. */
if (bfd_get_arch (abfd) == bfd_arch_cris) if (bfd_get_arch (abfd) == bfd_arch_cris)
N_SET_MACHTYPE (*execp, M_CRIS); N_SET_MACHTYPE (execp, M_CRIS);
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
WRITE_HEADERS (abfd, execp); WRITE_HEADERS (abfd, execp);

View File

@ -42,12 +42,12 @@ MY (callback) (bfd *abfd)
unsigned long arch_align; unsigned long arch_align;
/* Calculate the file positions of the parts of a newly read aout header. */ /* Calculate the file positions of the parts of a newly read aout header. */
obj_textsec (abfd)->size = N_TXTSIZE (*execp); obj_textsec (abfd)->size = N_TXTSIZE (execp);
/* The virtual memory addresses of the sections. */ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp); obj_textsec (abfd)->vma = N_TXTADDR (execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp); obj_datasec (abfd)->vma = N_DATADDR (execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp); obj_bsssec (abfd)->vma = N_BSSADDR (execp);
/* For some targets, if the entry point is not in the same page /* For some targets, if the entry point is not in the same page
as the start of the text, then adjust the VMA so that it is. as the start of the text, then adjust the VMA so that it is.
@ -71,20 +71,20 @@ MY (callback) (bfd *abfd)
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
/* The file offsets of the sections. */ /* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (execp);
/* The file offsets of the relocation info. */ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
/* The file offsets of the string table and symbol table. */ /* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH #ifdef SET_ARCH_MACH
SET_ARCH_MACH (abfd, *execp); SET_ARCH_MACH (abfd, execp);
#else #else
bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
#endif #endif
@ -149,11 +149,11 @@ MY (object_p) (bfd *abfd)
exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info); exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
#endif #endif
if (N_BADMAG (exec)) if (N_BADMAG (&exec))
return 0; return 0;
#ifdef MACHTYPE_OK #ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) if (!(MACHTYPE_OK (N_MACHTYPE (&exec))))
return 0; return 0;
#endif #endif
@ -332,9 +332,9 @@ MY_final_link_callback (bfd *abfd,
{ {
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
*ptreloff = N_TRELOFF (*execp); *ptreloff = N_TRELOFF (execp);
*pdreloff = N_DRELOFF (*execp); *pdreloff = N_DRELOFF (execp);
*psymoff = N_SYMOFF (*execp); *psymoff = N_SYMOFF (execp);
} }
#endif #endif

View File

@ -339,32 +339,32 @@ tic30_aout_callback (bfd *abfd)
unsigned long arch_align; unsigned long arch_align;
/* Calculate the file positions of the parts of a newly read aout header. */ /* Calculate the file positions of the parts of a newly read aout header. */
obj_textsec (abfd)->size = N_TXTSIZE (*execp); obj_textsec (abfd)->size = N_TXTSIZE (execp);
/* The virtual memory addresses of the sections. */ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp); obj_textsec (abfd)->vma = N_TXTADDR (execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp); obj_datasec (abfd)->vma = N_DATADDR (execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp); obj_bsssec (abfd)->vma = N_BSSADDR (execp);
obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
/* The file offsets of the sections. */ /* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (execp);
/* The file offsets of the relocation info. */ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
/* The file offsets of the string table and symbol table. */ /* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH #ifdef SET_ARCH_MACH
SET_ARCH_MACH (abfd, *execp); SET_ARCH_MACH (abfd, execp);
#else #else
bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L); bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L);
#endif #endif
@ -568,10 +568,10 @@ tic30_aout_object_p (bfd *abfd)
exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); exec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
#endif /* SWAP_MAGIC */ #endif /* SWAP_MAGIC */
if (N_BADMAG (exec)) if (N_BADMAG (&exec))
return 0; return 0;
#ifdef MACHTYPE_OK #ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) if (!(MACHTYPE_OK (N_MACHTYPE (&exec))))
return 0; return 0;
#endif #endif
@ -664,19 +664,19 @@ tic30_aout_write_object_contents (bfd *abfd)
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL if (bfd_get_outsymbols (abfd) != (asymbol **) NULL
&& bfd_get_symcount (abfd) != 0) && bfd_get_symcount (abfd) != 0)
{ {
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*execp)), SEEK_SET) != 0) if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0)
return FALSE; return FALSE;
if (!NAME (aout, write_syms) (abfd)) if (!NAME (aout, write_syms) (abfd))
return FALSE; return FALSE;
} }
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0)
return FALSE; return FALSE;
if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)))
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0)
return FALSE; return FALSE;
if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
return FALSE; return FALSE;

View File

@ -155,8 +155,8 @@ sunos_set_arch_mach (bfd *abfd, enum machine_type machtype)
bfd_set_arch_mach (abfd, arch, machine); bfd_set_arch_mach (abfd, arch, machine);
} }
#define SET_ARCH_MACH(ABFD, EXEC) \ #define SET_ARCH_MACH(ABFD, EXECP) \
NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \
choose_reloc_size(ABFD); choose_reloc_size(ABFD);
/* Determine the size of a relocation entry, based on the architecture. */ /* Determine the size of a relocation entry, based on the architecture. */
@ -194,14 +194,14 @@ sunos_write_object_contents (bfd *abfd)
switch (bfd_get_mach (abfd)) switch (bfd_get_mach (abfd))
{ {
case bfd_mach_m68000: case bfd_mach_m68000:
N_SET_MACHTYPE (*execp, M_UNKNOWN); N_SET_MACHTYPE (execp, M_UNKNOWN);
break; break;
case bfd_mach_m68010: case bfd_mach_m68010:
N_SET_MACHTYPE (*execp, M_68010); N_SET_MACHTYPE (execp, M_68010);
break; break;
default: default:
case bfd_mach_m68020: case bfd_mach_m68020:
N_SET_MACHTYPE (*execp, M_68020); N_SET_MACHTYPE (execp, M_68020);
break; break;
} }
break; break;
@ -209,28 +209,28 @@ sunos_write_object_contents (bfd *abfd)
switch (bfd_get_mach (abfd)) switch (bfd_get_mach (abfd))
{ {
case bfd_mach_sparc_sparclet: case bfd_mach_sparc_sparclet:
N_SET_MACHTYPE (*execp, M_SPARCLET); N_SET_MACHTYPE (execp, M_SPARCLET);
break; break;
case bfd_mach_sparc_sparclite_le: case bfd_mach_sparc_sparclite_le:
N_SET_MACHTYPE (*execp, M_SPARCLITE_LE); N_SET_MACHTYPE (execp, M_SPARCLITE_LE);
break; break;
default: default:
N_SET_MACHTYPE (*execp, M_SPARC); N_SET_MACHTYPE (execp, M_SPARC);
break; break;
} }
break; break;
case bfd_arch_i386: case bfd_arch_i386:
N_SET_MACHTYPE (*execp, M_386); N_SET_MACHTYPE (execp, M_386);
break; break;
default: default:
N_SET_MACHTYPE (*execp, M_UNKNOWN); N_SET_MACHTYPE (execp, M_UNKNOWN);
} }
choose_reloc_size (abfd); choose_reloc_size (abfd);
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
N_SET_DYNAMIC (*execp, (long)(bfd_get_file_flags (abfd) & DYNAMIC)); N_SET_DYNAMIC (execp, (long)(bfd_get_file_flags (abfd) & DYNAMIC));
WRITE_HEADERS (abfd, execp); WRITE_HEADERS (abfd, execp);
@ -397,7 +397,7 @@ swapcore_sun3 (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo); intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize); intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize); intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr); intcore->c_data_addr = N_DATADDR (&intcore->c_aouthdr);
intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos = offsetof (struct external_sun3_core, fp_stuff); intcore->fp_stuff_pos = offsetof (struct external_sun3_core, fp_stuff);
@ -432,7 +432,7 @@ swapcore_sparc (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo); intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize); intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize); intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr); intcore->c_data_addr = N_DATADDR (&intcore->c_aouthdr);
intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos = offsetof (struct external_sparc_core, fp_stuff); intcore->fp_stuff_pos = offsetof (struct external_sparc_core, fp_stuff);

View File

@ -488,27 +488,27 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
/* Setting of EXEC_P has been deferred to the bottom of this function. */ /* Setting of EXEC_P has been deferred to the bottom of this function. */
if (execp->a_syms) if (execp->a_syms)
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
if (N_DYNAMIC (*execp)) if (N_DYNAMIC (execp))
abfd->flags |= DYNAMIC; abfd->flags |= DYNAMIC;
if (N_MAGIC (*execp) == ZMAGIC) if (N_MAGIC (execp) == ZMAGIC)
{ {
abfd->flags |= D_PAGED | WP_TEXT; abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic; adata (abfd).magic = z_magic;
} }
else if (N_MAGIC (*execp) == QMAGIC) else if (N_MAGIC (execp) == QMAGIC)
{ {
abfd->flags |= D_PAGED | WP_TEXT; abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic; adata (abfd).magic = z_magic;
adata (abfd).subformat = q_magic_format; adata (abfd).subformat = q_magic_format;
} }
else if (N_MAGIC (*execp) == NMAGIC) else if (N_MAGIC (execp) == NMAGIC)
{ {
abfd->flags |= WP_TEXT; abfd->flags |= WP_TEXT;
adata (abfd).magic = n_magic; adata (abfd).magic = n_magic;
} }
else if (N_MAGIC (*execp) == OMAGIC else if (N_MAGIC (execp) == OMAGIC
|| N_MAGIC (*execp) == BMAGIC) || N_MAGIC (execp) == BMAGIC)
adata (abfd).magic = o_magic; adata (abfd).magic = o_magic;
else else
/* Should have been checked with N_BADMAG before this routine /* Should have been checked with N_BADMAG before this routine
@ -563,28 +563,28 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
struct exec *execp = exec_hdr (abfd); struct exec *execp = exec_hdr (abfd);
obj_textsec (abfd)->size = N_TXTSIZE (*execp); obj_textsec (abfd)->size = N_TXTSIZE (execp);
/* Data and bss are already filled in since they're so standard. */ /* Data and bss are already filled in since they're so standard. */
/* The virtual memory addresses of the sections. */ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp); obj_textsec (abfd)->vma = N_TXTADDR (execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp); obj_datasec (abfd)->vma = N_DATADDR (execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp); obj_bsssec (abfd)->vma = N_BSSADDR (execp);
/* The file offsets of the sections. */ /* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (execp);
/* The file offsets of the relocation info. */ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
/* The file offsets of the string table and symbol table. */ /* The file offsets of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file. */
switch (N_MACHTYPE (*exec_hdr (abfd))) switch (N_MACHTYPE (exec_hdr (abfd)))
{ {
default: default:
abfd->obj_arch = bfd_arch_obscure; abfd->obj_arch = bfd_arch_obscure;
@ -949,7 +949,7 @@ adjust_o_magic (bfd *abfd, struct internal_exec *execp)
execp->a_text = obj_textsec (abfd)->size; execp->a_text = obj_textsec (abfd)->size;
execp->a_data = obj_datasec (abfd)->size; execp->a_data = obj_datasec (abfd)->size;
execp->a_bss = obj_bsssec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size;
N_SET_MAGIC (*execp, OMAGIC); N_SET_MAGIC (execp, OMAGIC);
} }
static void static void
@ -1038,9 +1038,9 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
execp->a_text += adata (abfd).exec_bytes_size; execp->a_text += adata (abfd).exec_bytes_size;
if (obj_aout_subformat (abfd) == q_magic_format) if (obj_aout_subformat (abfd) == q_magic_format)
N_SET_MAGIC (*execp, QMAGIC); N_SET_MAGIC (execp, QMAGIC);
else else
N_SET_MAGIC (*execp, ZMAGIC); N_SET_MAGIC (execp, ZMAGIC);
/* Spec says data section should be rounded up to page boundary. */ /* Spec says data section should be rounded up to page boundary. */
obj_datasec (abfd)->size obj_datasec (abfd)->size
@ -1107,7 +1107,7 @@ adjust_n_magic (bfd *abfd, struct internal_exec *execp)
execp->a_text = obj_textsec (abfd)->size; execp->a_text = obj_textsec (abfd)->size;
execp->a_data = obj_datasec (abfd)->size; execp->a_data = obj_datasec (abfd)->size;
execp->a_bss = obj_bsssec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size;
N_SET_MAGIC (*execp, NMAGIC); N_SET_MAGIC (execp, NMAGIC);
} }
bfd_boolean bfd_boolean

View File

@ -137,8 +137,8 @@ b_out_callback (bfd *abfd)
); );
/* The positions of the string table and symbol table. */ /* The positions of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
/* The alignments of the sections. */ /* The alignments of the sections. */
obj_textsec (abfd)->alignment_power = execp->a_talign; obj_textsec (abfd)->alignment_power = execp->a_talign;
@ -161,12 +161,12 @@ b_out_callback (bfd *abfd)
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
/* The file positions of the sections. */ /* The file positions of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (execp);
/* The file positions of the relocation info. */ /* The file positions of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TROFF (*execp); obj_textsec (abfd)->rel_filepos = N_TROFF (execp);
obj_datasec (abfd)->rel_filepos = N_DROFF (*execp); obj_datasec (abfd)->rel_filepos = N_DROFF (execp);
adata (abfd).page_size = 1; /* Not applicable. */ adata (abfd).page_size = 1; /* Not applicable. */
adata (abfd).segment_size = 1; /* Not applicable. */ adata (abfd).segment_size = 1; /* Not applicable. */
@ -193,7 +193,7 @@ b_out_object_p (bfd *abfd)
anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info); anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
if (N_BADMAG (anexec)) if (N_BADMAG (&anexec))
{ {
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
return 0; return 0;
@ -450,20 +450,20 @@ b_out_write_object_contents (bfd *abfd)
b_out_symbol_cmp); b_out_symbol_cmp);
/* Back to your regularly scheduled program. */ /* Back to your regularly scheduled program. */
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET) if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (exec_hdr (abfd))), SEEK_SET)
!= 0) != 0)
return FALSE; return FALSE;
if (! aout_32_write_syms (abfd)) if (! aout_32_write_syms (abfd))
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) (N_TROFF (*exec_hdr (abfd))), SEEK_SET) if (bfd_seek (abfd, (file_ptr) (N_TROFF (exec_hdr (abfd))), SEEK_SET)
!= 0) != 0)
return FALSE; return FALSE;
if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd)))
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) (N_DROFF (*exec_hdr (abfd))), SEEK_SET) if (bfd_seek (abfd, (file_ptr) (N_DROFF (exec_hdr (abfd))), SEEK_SET)
!= 0) != 0)
return FALSE; return FALSE;

View File

@ -25,31 +25,31 @@
/* ZMAGIC files start at offset 0. Does not apply to QMAGIC files. */ /* ZMAGIC files start at offset 0. Does not apply to QMAGIC files. */
#define TEXT_START_ADDR 0 #define TEXT_START_ADDR 0
#define N_GETMAGIC_NET(exec) \ #define N_GETMAGIC_NET(execp) \
((exec).a_info & 0xffff) ((execp)->a_info & 0xffff)
#define N_GETMID_NET(exec) \ #define N_GETMID_NET(execp) \
(((exec).a_info >> 16) & 0x3ff) (((execp)->a_info >> 16) & 0x3ff)
#define N_GETFLAG_NET(ex) \ #define N_GETFLAG_NET(exexp) \
(((exec).a_info >> 26) & 0x3f) (((execp)->a_info >> 26) & 0x3f)
#define N_MACHTYPE(exec) \ #define N_MACHTYPE(execp) \
((enum machine_type) \ ((enum machine_type) \
((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETMID_NET (exec) : \ ((N_GETMAGIC_NET (execp) == ZMAGIC) ? N_GETMID_NET (execp) : \
((exec).a_info >> 16) & 0x3ff)) ((execp)->a_info >> 16) & 0x3ff))
#define N_FLAGS(exec) \ #define N_FLAGS(execp) \
((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETFLAG_NET (exec) : \ ((N_GETMAGIC_NET (execp) == ZMAGIC) ? N_GETFLAG_NET (execp) : \
((exec).a_info >> 26) & 0x3f) ((execp)->a_info >> 26) & 0x3f)
#define N_SET_INFO(exec, magic, type, flags) \ #define N_SET_INFO(execp, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \ ((execp)->a_info = ((magic) & 0xffff) \
| (((int)(type) & 0x3ff) << 16) \ | (((int)(type) & 0x3ff) << 16) \
| (((flags) & 0x3f) << 26)) | (((flags) & 0x3f) << 26))
#define N_SET_MACHTYPE(exec, machtype) \ #define N_SET_MACHTYPE(execp, machtype) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) ((execp)->a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16))
#define N_SET_FLAGS(exec, flags) \ #define N_SET_FLAGS(execp, flags) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) ((execp)->a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
#include "sysdep.h" #include "sysdep.h"
#include "bfd.h" #include "bfd.h"
@ -82,25 +82,25 @@ MY (write_object_contents) (bfd *abfd)
{ {
case bfd_arch_m68k: case bfd_arch_m68k:
if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0) if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0)
N_SET_MACHTYPE (*execp, M_68K4K_NETBSD); N_SET_MACHTYPE (execp, M_68K4K_NETBSD);
else else
N_SET_MACHTYPE (*execp, M_68K_NETBSD); N_SET_MACHTYPE (execp, M_68K_NETBSD);
break; break;
case bfd_arch_sparc: case bfd_arch_sparc:
N_SET_MACHTYPE (*execp, M_SPARC_NETBSD); N_SET_MACHTYPE (execp, M_SPARC_NETBSD);
break; break;
case bfd_arch_i386: case bfd_arch_i386:
N_SET_MACHTYPE (*execp, M_386_NETBSD); N_SET_MACHTYPE (execp, M_386_NETBSD);
break; break;
case bfd_arch_ns32k: case bfd_arch_ns32k:
N_SET_MACHTYPE (*execp, M_532_NETBSD); N_SET_MACHTYPE (execp, M_532_NETBSD);
break; break;
default: default:
N_SET_MACHTYPE (*execp, M_UNKNOWN); N_SET_MACHTYPE (execp, M_UNKNOWN);
break; break;
} }
WRITE_HEADERS(abfd, execp); WRITE_HEADERS (abfd, execp);
return TRUE; return TRUE;
} }

View File

@ -57,7 +57,7 @@ main (int argc, char** argv)
fclose (file); fclose (file);
#ifdef N_TXTOFF #ifdef N_TXTOFF
page_size = N_TXTOFF(my_exec); page_size = N_TXTOFF (&my_exec);
if (page_size == 0) if (page_size == 0)
printf ("#define N_HEADER_IN_TEXT(x) 1\n"); printf ("#define N_HEADER_IN_TEXT(x) 1\n");
else else

View File

@ -224,32 +224,32 @@ MY (callback) (bfd *abfd)
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
/* Calculate the file positions of the parts of a newly read aout header */ /* Calculate the file positions of the parts of a newly read aout header */
obj_textsec (abfd)->size = N_TXTSIZE (*execp); obj_textsec (abfd)->size = N_TXTSIZE (execp);
/* The virtual memory addresses of the sections */ /* The virtual memory addresses of the sections */
obj_textsec (abfd)->vma = N_TXTADDR (*execp); obj_textsec (abfd)->vma = N_TXTADDR (execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp); obj_datasec (abfd)->vma = N_DATADDR (execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp); obj_bsssec (abfd)->vma = N_BSSADDR (execp);
obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
/* The file offsets of the sections */ /* The file offsets of the sections */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (execp);
/* The file offsets of the relocation info */ /* The file offsets of the relocation info */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
/* The file offsets of the string table and symbol table. */ /* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH #ifdef SET_ARCH_MACH
SET_ARCH_MACH (abfd, *execp); SET_ARCH_MACH (abfd, execp);
#else #else
bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
#endif #endif
@ -257,11 +257,11 @@ MY (callback) (bfd *abfd)
if (obj_aout_subformat (abfd) == gnu_encap_format) if (obj_aout_subformat (abfd) == gnu_encap_format)
{ {
/* The file offsets of the relocation info */ /* The file offsets of the relocation info */
obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF (*execp); obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF (*execp); obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF (execp);
/* The file offsets of the string table and symbol table. */ /* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_GNU_SYMOFF (*execp); obj_sym_filepos (abfd) = N_GNU_SYMOFF (execp);
obj_str_filepos (abfd) = (obj_sym_filepos (abfd) + execp->a_syms); obj_str_filepos (abfd) = (obj_sym_filepos (abfd) + execp->a_syms);
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
@ -298,8 +298,8 @@ MY (write_object_contents) (bfd * abfd)
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
obj_reloc_entry_size (abfd)); obj_reloc_entry_size (abfd));
N_SET_MACHTYPE (*execp, 0xc); N_SET_MACHTYPE (execp, 0xc);
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes); NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes);
@ -319,7 +319,7 @@ MY (write_object_contents) (bfd * abfd)
if (bfd_get_symcount (abfd) != 0) if (bfd_get_symcount (abfd) != 0)
{ {
/* Skip the relocs to where we want to put the symbols. */ /* Skip the relocs to where we want to put the symbols. */
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize), if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp) + execp->a_drsize),
SEEK_SET) != 0) SEEK_SET) != 0)
return FALSE; return FALSE;
} }
@ -329,11 +329,11 @@ MY (write_object_contents) (bfd * abfd)
if (bfd_get_symcount (abfd) != 0) if (bfd_get_symcount (abfd) != 0)
{ {
if (bfd_seek (abfd, (file_ptr) N_TRELOFF (*execp), SEEK_CUR) != 0) if (bfd_seek (abfd, (file_ptr) N_TRELOFF (execp), SEEK_CUR) != 0)
return FALSE; return FALSE;
if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0) if (bfd_seek (abfd, (file_ptr) N_DRELOFF (execp), SEEK_CUR) != 0)
return FALSE; return FALSE;
if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))
return FALSE; return FALSE;

View File

@ -28,7 +28,7 @@
#define N_HEADER_IN_TEXT(x) 0 #define N_HEADER_IN_TEXT(x) 0
#define N_TXTOFF(x) 0x20 #define N_TXTOFF(x) 0x20
#define N_TXTADDR(x) (N_MAGIC (x) == ZMAGIC ? 0x1020 : 0) #define N_TXTADDR(x) (N_MAGIC (x) == ZMAGIC ? 0x1020 : 0)
#define N_TXTSIZE(x) ((x).a_text) #define N_TXTSIZE(x) ((x)->a_text)
#define TARGET_PAGE_SIZE 4096 #define TARGET_PAGE_SIZE 4096
#define SEGMENT_SIZE 0x400000 #define SEGMENT_SIZE 0x400000
#define DEFAULT_ARCH bfd_arch_i386 #define DEFAULT_ARCH bfd_arch_i386
@ -54,7 +54,7 @@ i386aout_write_object_contents (bfd *abfd)
struct external_exec exec_bytes; struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
N_SET_MACHTYPE (*execp, M_386); N_SET_MACHTYPE (execp, M_386);
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;

View File

@ -70,11 +70,11 @@ i386linux_write_object_contents (bfd *abfd)
struct external_exec exec_bytes; struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
N_SET_MACHTYPE (*execp, M_386); N_SET_MACHTYPE (execp, M_386);
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
WRITE_HEADERS(abfd, execp); WRITE_HEADERS (abfd, execp);
return TRUE; return TRUE;
} }

View File

@ -58,19 +58,19 @@
\ \
if (bfd_get_symcount (abfd) != 0) \ if (bfd_get_symcount (abfd) != 0) \
{ \ { \
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) \ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) \
!= 0) \ != 0) \
return FALSE; \ return FALSE; \
\ \
if (! NAME(aout,write_syms) (abfd)) return FALSE; \ if (! NAME(aout,write_syms) (abfd)) return FALSE; \
\ \
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) \ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) \
!= 0) \ != 0) \
return FALSE; \ return FALSE; \
\ \
if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
return FALSE; \ return FALSE; \
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) \ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) \
!= 0) \ != 0) \
return 0; \ return 0; \
\ \

View File

@ -32,7 +32,7 @@
/* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */ /* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */
#define N_HEADER_IN_TEXT(x) 1 #define N_HEADER_IN_TEXT(x) 1
#define N_TXTSIZE(x) ((x).a_text) #define N_TXTSIZE(x) ((x)->a_text)
#include "sysdep.h" #include "sysdep.h"
#include "bfd.h" #include "bfd.h"

View File

@ -103,8 +103,8 @@ os9k_callback (bfd *abfd)
obj_datasec (abfd)->filepos = execp->a_dload; obj_datasec (abfd)->filepos = execp->a_dload;
/* The file positions of the relocation info *** /* The file positions of the relocation info ***
obj_textsec (abfd)->rel_filepos = N_TROFF(*execp); obj_textsec (abfd)->rel_filepos = N_TROFF (execp);
obj_datasec (abfd)->rel_filepos = N_DROFF(*execp); */ obj_datasec (abfd)->rel_filepos = N_DROFF (execp); */
adata (abfd).page_size = 1; /* Not applicable. */ adata (abfd).page_size = 1; /* Not applicable. */
adata (abfd).segment_size = 1;/* Not applicable. */ adata (abfd).segment_size = 1;/* Not applicable. */
@ -128,7 +128,7 @@ os9k_object_p (bfd *abfd)
} }
anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync);
if (N_BADMAG (anexec)) if (N_BADMAG (&anexec))
{ {
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
return 0; return 0;

View File

@ -291,48 +291,48 @@ enum machine_type
M_CRIS = 255 /* Axis CRIS binary. */ M_CRIS = 255 /* Axis CRIS binary. */
}; };
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000) #define N_DYNAMIC(execp) ((execp)->a_info & 0x80000000)
#ifndef N_MAGIC #ifndef N_MAGIC
# define N_MAGIC(exec) ((exec).a_info & 0xffff) # define N_MAGIC(execp) ((execp)->a_info & 0xffff)
#endif #endif
#ifndef N_MACHTYPE #ifndef N_MACHTYPE
# define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) # define N_MACHTYPE(execp) ((enum machine_type)(((execp)->a_info >> 16) & 0xff))
#endif #endif
#ifndef N_FLAGS #ifndef N_FLAGS
# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) # define N_FLAGS(execp) (((execp)->a_info >> 24) & 0xff)
#endif #endif
#ifndef N_SET_INFO #ifndef N_SET_INFO
# define N_SET_INFO(exec, magic, type, flags) \ # define N_SET_INFO(execp, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \ ((execp)->a_info = ((magic) & 0xffff) \
| (((int)(type) & 0xff) << 16) \ | (((int)(type) & 0xff) << 16) \
| (((flags) & 0xff) << 24)) | (((flags) & 0xff) << 24))
#endif #endif
#ifndef N_SET_DYNAMIC #ifndef N_SET_DYNAMIC
# define N_SET_DYNAMIC(exec, dynamic) \ # define N_SET_DYNAMIC(execp, dynamic) \
((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \ ((execp)->a_info = (dynamic) ? (long) ((execp)->a_info | 0x80000000) : \
((exec).a_info & 0x7fffffff)) ((execp)->a_info & 0x7fffffff))
#endif #endif
#ifndef N_SET_MAGIC #ifndef N_SET_MAGIC
# define N_SET_MAGIC(exec, magic) \ # define N_SET_MAGIC(execp, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) ((execp)->a_info = (((execp)->a_info & 0xffff0000) | ((magic) & 0xffff)))
#endif #endif
#ifndef N_SET_MACHTYPE #ifndef N_SET_MACHTYPE
# define N_SET_MACHTYPE(exec, machtype) \ # define N_SET_MACHTYPE(execp, machtype) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) ((execp)->a_info & 0xff00ffff) | ((((int) (machtype)) &0xff) << 16))
#endif #endif
#ifndef N_SET_FLAGS #ifndef N_SET_FLAGS
# define N_SET_FLAGS(exec, flags) \ # define N_SET_FLAGS(execp, flags) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) ((execp)->a_info & 0x00ffffff) | (((flags) & 0xff) << 24))
#endif #endif
typedef struct aout_symbol typedef struct aout_symbol
@ -648,19 +648,19 @@ extern bfd_boolean NAME (aout, bfd_free_cached_info)
if (bfd_get_outsymbols (abfd) != NULL \ if (bfd_get_outsymbols (abfd) != NULL \
&& bfd_get_symcount (abfd) != 0) \ && bfd_get_symcount (abfd) != 0) \
{ \ { \
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0)\
return FALSE; \ return FALSE; \
\ \
if (! NAME (aout, write_syms) (abfd)) \ if (! NAME (aout, write_syms) (abfd)) \
return FALSE; \ return FALSE; \
} \ } \
\ \
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) \ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0) \
return FALSE; \ return FALSE; \
if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \ if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
return FALSE; \ return FALSE; \
\ \
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) \ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0) \
return FALSE; \ return FALSE; \
if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
return FALSE; \ return FALSE; \

View File

@ -69,11 +69,11 @@ m68klinux_write_object_contents (bfd *abfd)
struct external_exec exec_bytes; struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
N_SET_MACHTYPE (*execp, M_68020); N_SET_MACHTYPE (execp, M_68020);
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
WRITE_HEADERS(abfd, execp); WRITE_HEADERS (abfd, execp);
return TRUE; return TRUE;
} }

View File

@ -23,7 +23,7 @@
#define TEXT_START_ADDR 0 #define TEXT_START_ADDR 0
#define N_HEADER_IN_TEXT(x) 1 /* (N_MAGIG(x) == ZMAGIC) */ #define N_HEADER_IN_TEXT(x) 1 /* (N_MAGIG(x) == ZMAGIC) */
#define N_TXTSIZE(x) ((x).a_text) #define N_TXTSIZE(x) ((x)->a_text)
#include "sysdep.h" #include "sysdep.h"
#include "bfd.h" #include "bfd.h"

View File

@ -23,7 +23,7 @@
/* #define ENTRY_CAN_BE_ZERO */ /* #define ENTRY_CAN_BE_ZERO */
#define N_HEADER_IN_TEXT(x) 1 #define N_HEADER_IN_TEXT(x) 1
#define N_TXTADDR(x) \ #define N_TXTADDR(x) \
(N_MAGIC(x) != ZMAGIC ? (x).a_entry : /* object file or NMAGIC */\ (N_MAGIC(x) != ZMAGIC ? (x)->a_entry : /* object file or NMAGIC */\
TEXT_START_ADDR + EXEC_BYTES_SIZE /* no padding */\ TEXT_START_ADDR + EXEC_BYTES_SIZE /* no padding */\
) )
#define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x)) #define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x))
@ -45,8 +45,8 @@
#include "libbfd.h" #include "libbfd.h"
#include "libaout.h" #include "libaout.h"
#define SET_ARCH_MACH(ABFD, EXEC) \ #define SET_ARCH_MACH(ABFD, EXECP) \
MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ MY(set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \
MY(choose_reloc_size) (ABFD); MY(choose_reloc_size) (ABFD);
static void MY(set_arch_mach) (bfd *, unsigned long); static void MY(set_arch_mach) (bfd *, unsigned long);
static void MY(choose_reloc_size) (bfd *); static void MY(choose_reloc_size) (bfd *);
@ -137,34 +137,34 @@ MY (write_object_contents) (bfd *abfd)
switch (bfd_get_mach (abfd)) switch (bfd_get_mach (abfd))
{ {
case bfd_mach_m68010: case bfd_mach_m68010:
N_SET_MACHTYPE (*execp, M_68010); N_SET_MACHTYPE (execp, M_68010);
break; break;
default: default:
case bfd_mach_m68020: case bfd_mach_m68020:
N_SET_MACHTYPE (*execp, M_68020); N_SET_MACHTYPE (execp, M_68020);
break; break;
} }
break; break;
case bfd_arch_sparc: case bfd_arch_sparc:
N_SET_MACHTYPE (*execp, M_SPARC); N_SET_MACHTYPE (execp, M_SPARC);
break; break;
case bfd_arch_i386: case bfd_arch_i386:
N_SET_MACHTYPE (*execp, M_386); N_SET_MACHTYPE (execp, M_386);
break; break;
case bfd_arch_mips: case bfd_arch_mips:
switch (bfd_get_mach (abfd)) switch (bfd_get_mach (abfd))
{ {
case bfd_mach_mips4000: case bfd_mach_mips4000:
case bfd_mach_mips6000: case bfd_mach_mips6000:
N_SET_MACHTYPE (*execp, M_MIPS2); N_SET_MACHTYPE (execp, M_MIPS2);
break; break;
default: default:
N_SET_MACHTYPE (*execp, M_MIPS1); N_SET_MACHTYPE (execp, M_MIPS1);
break; break;
} }
break; break;
default: default:
N_SET_MACHTYPE (*execp, M_UNKNOWN); N_SET_MACHTYPE (execp, M_UNKNOWN);
} }
MY (choose_reloc_size) (abfd); MY (choose_reloc_size) (abfd);

View File

@ -34,21 +34,21 @@
#define N_SHARED_LIB(x) (N_DYNAMIC (x)) #define N_SHARED_LIB(x) (N_DYNAMIC (x))
/* We have 6 bits of flags and 10 bits of machine ID. */ /* We have 6 bits of flags and 10 bits of machine ID. */
#define N_MACHTYPE(exec) \ #define N_MACHTYPE(execp) \
((enum machine_type) (((exec).a_info >> 16) & 0x03ff)) ((enum machine_type) (((execp)->a_info >> 16) & 0x03ff))
#define N_FLAGS(exec) \ #define N_FLAGS(execp) \
(((exec).a_info >> 26) & 0x3f) (((execp)->a_info >> 26) & 0x3f)
#define N_SET_INFO(exec, magic, type, flags) \ #define N_SET_INFO(execp, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \ ((execp)->a_info = ((magic) & 0xffff) \
| (((int) (type) & 0x3ff) << 16) \ | (((int) (type) & 0x3ff) << 16) \
| (((flags) & 0x3f) << 24)) | (((flags) & 0x3f) << 24))
#define N_SET_MACHTYPE(exec, machtype) \ #define N_SET_MACHTYPE(execp, machtype) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) ((execp)->a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16))
#define N_SET_FLAGS(exec, flags) \ #define N_SET_FLAGS(execp, flags) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) ((execp)->a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
#include "sysdep.h" #include "sysdep.h"
#include "bfd.h" #include "bfd.h"
@ -97,10 +97,10 @@ MY (write_object_contents) (bfd *abfd)
switch (bfd_get_arch(abfd)) switch (bfd_get_arch(abfd))
{ {
case DEFAULT_ARCH: case DEFAULT_ARCH:
N_SET_MACHTYPE(*execp, DEFAULT_MID); N_SET_MACHTYPE (execp, DEFAULT_MID);
break; break;
default: default:
N_SET_MACHTYPE(*execp, M_UNKNOWN); N_SET_MACHTYPE (execp, M_UNKNOWN);
break; break;
} }

View File

@ -31,7 +31,7 @@
1 and specially define our own N_TXTSIZE. */ 1 and specially define our own N_TXTSIZE. */
#define N_HEADER_IN_TEXT(x) 1 #define N_HEADER_IN_TEXT(x) 1
#define N_TXTSIZE(x) ((x).a_text) #define N_TXTSIZE(x) ((x)->a_text)
#define TEXT_START_ADDR 0x10000 /* from old ld */ #define TEXT_START_ADDR 0x10000 /* from old ld */
#define TARGET_PAGE_SIZE 0x1000 /* from old ld, 032 & 532 are really 512/4k */ #define TARGET_PAGE_SIZE 0x1000 /* from old ld, 032 & 532 are really 512/4k */
@ -39,7 +39,7 @@
/* Use a_entry of 0 to distinguish object files from OMAGIC executables */ /* Use a_entry of 0 to distinguish object files from OMAGIC executables */
#define N_TXTADDR(x) \ #define N_TXTADDR(x) \
(N_MAGIC(x) == OMAGIC ? \ (N_MAGIC(x) == OMAGIC ? \
((x).a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \ ((x)->a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \
(N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \ (N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \
TEXT_START_ADDR + EXEC_BYTES_SIZE)) TEXT_START_ADDR + EXEC_BYTES_SIZE))
@ -89,16 +89,16 @@ MY(write_object_contents) (bfd *abfd)
switch (bfd_get_mach (abfd)) switch (bfd_get_mach (abfd))
{ {
case 32032: case 32032:
N_SET_MACHTYPE (*execp, M_NS32032); N_SET_MACHTYPE (execp, M_NS32032);
break; break;
case 32532: case 32532:
default: default:
N_SET_MACHTYPE (*execp, M_NS32532); N_SET_MACHTYPE (execp, M_NS32532);
break; break;
} }
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
WRITE_HEADERS(abfd, execp); WRITE_HEADERS (abfd, execp);
return TRUE; return TRUE;
} }

View File

@ -58,9 +58,9 @@
#define N_HEADER_IN_TEXT(x) 0 #define N_HEADER_IN_TEXT(x) 0
/* There is no flags field. */ /* There is no flags field. */
#define N_FLAGS(exec) 0 #define N_FLAGS(execp) 0
#define N_SET_FLAGS(exec, flags) do { } while (0) #define N_SET_FLAGS(execp, flags) do { } while (0)
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC) && N_MAGIC(x) != ZMAGIC)
@ -111,11 +111,11 @@ struct pdp11_external_nlist
#define EXTERNAL_NLIST_SIZE 8 #define EXTERNAL_NLIST_SIZE 8
#define N_TXTOFF(x) (EXEC_BYTES_SIZE) #define N_TXTOFF(x) (EXEC_BYTES_SIZE)
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) #define N_DATOFF(x) (N_TXTOFF(x) + (x)->a_text)
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) #define N_TRELOFF(x) (N_DATOFF(x) + (x)->a_data)
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) #define N_DRELOFF(x) (N_TRELOFF(x) + (x)->a_trsize)
#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize) #define N_SYMOFF(x) (N_DRELOFF(x) + (x)->a_drsize)
#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) #define N_STROFF(x) (N_SYMOFF(x) + (x)->a_syms)
#define WRITE_HEADERS(abfd, execp) pdp11_aout_write_headers (abfd, execp) #define WRITE_HEADERS(abfd, execp) pdp11_aout_write_headers (abfd, execp)
@ -326,7 +326,7 @@ pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp)
if (bfd_get_outsymbols (abfd) != NULL if (bfd_get_outsymbols (abfd) != NULL
&& bfd_get_symcount (abfd) != 0) && bfd_get_symcount (abfd) != 0)
{ {
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0)
return FALSE; return FALSE;
if (! NAME (aout, write_syms) (abfd)) if (! NAME (aout, write_syms) (abfd))
@ -336,9 +336,9 @@ pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp)
if (obj_textsec (abfd)->reloc_count > 0 if (obj_textsec (abfd)->reloc_count > 0
|| obj_datasec (abfd)->reloc_count > 0) || obj_datasec (abfd)->reloc_count > 0)
{ {
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0 if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0
|| !NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)) || !NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))
|| bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0 || bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0
|| !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) || !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
return FALSE; return FALSE;
} }
@ -492,20 +492,20 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
/* Setting of EXEC_P has been deferred to the bottom of this function. */ /* Setting of EXEC_P has been deferred to the bottom of this function. */
if (execp->a_syms) if (execp->a_syms)
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
if (N_DYNAMIC(*execp)) if (N_DYNAMIC (execp))
abfd->flags |= DYNAMIC; abfd->flags |= DYNAMIC;
if (N_MAGIC (*execp) == ZMAGIC) if (N_MAGIC (execp) == ZMAGIC)
{ {
abfd->flags |= D_PAGED | WP_TEXT; abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic; adata (abfd).magic = z_magic;
} }
else if (N_MAGIC (*execp) == NMAGIC) else if (N_MAGIC (execp) == NMAGIC)
{ {
abfd->flags |= WP_TEXT; abfd->flags |= WP_TEXT;
adata (abfd).magic = n_magic; adata (abfd).magic = n_magic;
} }
else if (N_MAGIC (*execp) == OMAGIC) else if (N_MAGIC (execp) == OMAGIC)
adata (abfd).magic = o_magic; adata (abfd).magic = o_magic;
else else
{ {
@ -562,25 +562,25 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
in by the callback: */ in by the callback: */
struct exec *execp = exec_hdr (abfd); struct exec *execp = exec_hdr (abfd);
obj_textsec (abfd)->size = N_TXTSIZE(*execp); obj_textsec (abfd)->size = N_TXTSIZE (execp);
/* Data and bss are already filled in since they're so standard. */ /* Data and bss are already filled in since they're so standard. */
/* The virtual memory addresses of the sections. */ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR(*execp); obj_textsec (abfd)->vma = N_TXTADDR (execp);
obj_datasec (abfd)->vma = N_DATADDR(*execp); obj_datasec (abfd)->vma = N_DATADDR (execp);
obj_bsssec (abfd)->vma = N_BSSADDR(*execp); obj_bsssec (abfd)->vma = N_BSSADDR (execp);
/* The file offsets of the sections. */ /* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF(*execp); obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF(*execp); obj_datasec (abfd)->filepos = N_DATOFF (execp);
/* The file offsets of the relocation info. */ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
/* The file offsets of the string table and symbol table. */ /* The file offsets of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp); obj_str_filepos (abfd) = N_STROFF (execp);
obj_sym_filepos (abfd) = N_SYMOFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (execp);
/* Determine the architecture and machine type of the object file. */ /* Determine the architecture and machine type of the object file. */
abfd->obj_arch = bfd_arch_obscure; abfd->obj_arch = bfd_arch_obscure;
@ -860,7 +860,7 @@ adjust_o_magic (bfd *abfd, struct internal_exec *execp)
execp->a_text = obj_textsec (abfd)->size; execp->a_text = obj_textsec (abfd)->size;
execp->a_data = obj_datasec (abfd)->size; execp->a_data = obj_datasec (abfd)->size;
execp->a_bss = obj_bsssec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size;
N_SET_MAGIC (*execp, OMAGIC); N_SET_MAGIC (execp, OMAGIC);
} }
static void static void
@ -944,7 +944,7 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
execp->a_text = obj_textsec(abfd)->size; execp->a_text = obj_textsec(abfd)->size;
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
execp->a_text += adata(abfd).exec_bytes_size; execp->a_text += adata(abfd).exec_bytes_size;
N_SET_MAGIC (*execp, ZMAGIC); N_SET_MAGIC (execp, ZMAGIC);
/* Spec says data section should be rounded up to page boundary. */ /* Spec says data section should be rounded up to page boundary. */
obj_datasec(abfd)->size obj_datasec(abfd)->size
@ -1011,7 +1011,7 @@ adjust_n_magic (bfd *abfd, struct internal_exec *execp)
execp->a_text = obj_textsec(abfd)->size; execp->a_text = obj_textsec(abfd)->size;
execp->a_data = obj_datasec(abfd)->size; execp->a_data = obj_datasec(abfd)->size;
execp->a_bss = obj_bsssec(abfd)->size; execp->a_bss = obj_bsssec(abfd)->size;
N_SET_MAGIC (*execp, NMAGIC); N_SET_MAGIC (execp, NMAGIC);
} }
bfd_boolean bfd_boolean

View File

@ -63,11 +63,11 @@
/* Sl which uses another. */ /* Sl which uses another. */
#define SLPZMAGIC (MF_USES_SL | SLZMAGIC) #define SLPZMAGIC (MF_USES_SL | SLZMAGIC)
#define N_SHARED_LIB(x) ((x).a_info & MF_USES_SL) #define N_SHARED_LIB(x) ((x)->a_info & MF_USES_SL)
/* Only a pure OMAGIC file has the minimal header. */ /* Only a pure OMAGIC file has the minimal header. */
#define N_TXTOFF(x) \ #define N_TXTOFF(x) \
((x).a_info == OMAGIC \ ((x)->a_info == OMAGIC \
? 32 \ ? 32 \
: (N_MAGIC(x) == ZMAGIC \ : (N_MAGIC(x) == ZMAGIC \
? TARGET_PAGE_SIZE \ ? TARGET_PAGE_SIZE \
@ -81,13 +81,13 @@
up we can't know exactly what the address will be. A reasonable guess \ up we can't know exactly what the address will be. A reasonable guess \
is that a_entry will be in the first page of the executable. */ \ is that a_entry will be in the first page of the executable. */ \
: (N_SHARED_LIB(x) \ : (N_SHARED_LIB(x) \
? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ ? ((x)->a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \
: (bfd_vma) TEXT_START_ADDR)) : (bfd_vma) TEXT_START_ADDR))
#define N_SYMOFF(x) \ #define N_SYMOFF(x) \
(N_TXTOFF (x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize) (N_TXTOFF (x) + (x)->a_text + (x)->a_data + (x)->a_trsize + (x)->a_drsize)
#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms) #define N_STROFF(x) (N_SYMOFF (x) + (x)->a_syms)
#define TEXT_START_ADDR 32768 #define TEXT_START_ADDR 32768
#define TARGET_PAGE_SIZE 32768 #define TARGET_PAGE_SIZE 32768
@ -99,10 +99,10 @@
the tokens. */ the tokens. */
#define MY(OP) CONCAT2 (arm_aout_riscix_,OP) #define MY(OP) CONCAT2 (arm_aout_riscix_,OP)
#define TARGETNAME "a.out-riscix" #define TARGETNAME "a.out-riscix"
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) \ #define N_BADMAG(x) ((((x)->a_info & ~007200) != ZMAGIC) \
&& (((x).a_info & ~006000) != OMAGIC) \ && (((x)->a_info & ~006000) != OMAGIC) \
&& ((x).a_info != NMAGIC)) && ((x)->a_info != NMAGIC))
#define N_MAGIC(x) ((x).a_info & ~07200) #define N_MAGIC(x) ((x)->a_info & ~07200)
#include "sysdep.h" #include "sysdep.h"
#include "bfd.h" #include "bfd.h"
@ -134,18 +134,18 @@
if (bfd_get_outsymbols (abfd) != NULL \ if (bfd_get_outsymbols (abfd) != NULL \
&& bfd_get_symcount (abfd) != 0) \ && bfd_get_symcount (abfd) != 0) \
{ \ { \
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (* execp)), SEEK_SET) != 0)\ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0) \
return FALSE; \ return FALSE; \
\ \
if (! NAME (aout, write_syms) (abfd)) \ if (! NAME (aout, write_syms) (abfd)) \
return FALSE; \ return FALSE; \
\ \
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (* execp)), SEEK_SET) != 0)\ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0) \
return FALSE; \ return FALSE; \
\ \
if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \ if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \
return FALSE; \ return FALSE; \
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (* execp)), SEEK_SET) != 0)\ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0) \
return FALSE; \ return FALSE; \
\ \
if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
@ -517,7 +517,7 @@ riscix_some_aout_object_p (bfd *abfd,
/* Setting of EXEC_P has been deferred to the bottom of this function. */ /* Setting of EXEC_P has been deferred to the bottom of this function. */
if (execp->a_syms) if (execp->a_syms)
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
if (N_DYNAMIC(*execp)) if (N_DYNAMIC (execp))
abfd->flags |= DYNAMIC; abfd->flags |= DYNAMIC;
/* Squeezed files aren't supported (yet)! */ /* Squeezed files aren't supported (yet)! */
@ -532,17 +532,17 @@ riscix_some_aout_object_p (bfd *abfd,
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
return NULL; return NULL;
} }
else if (N_MAGIC (*execp) == ZMAGIC) else if (N_MAGIC (execp) == ZMAGIC)
{ {
abfd->flags |= D_PAGED | WP_TEXT; abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic; adata (abfd).magic = z_magic;
} }
else if (N_MAGIC (*execp) == NMAGIC) else if (N_MAGIC (execp) == NMAGIC)
{ {
abfd->flags |= WP_TEXT; abfd->flags |= WP_TEXT;
adata (abfd).magic = n_magic; adata (abfd).magic = n_magic;
} }
else if (N_MAGIC (*execp) == OMAGIC) else if (N_MAGIC (execp) == OMAGIC)
adata (abfd).magic = o_magic; adata (abfd).magic = o_magic;
else else
/* Should have been checked with N_BADMAG before this routine /* Should have been checked with N_BADMAG before this routine
@ -637,11 +637,11 @@ MY (object_p) (bfd *abfd)
exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); exec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
if (N_BADMAG (exec)) if (N_BADMAG (&exec))
return NULL; return NULL;
#ifdef MACHTYPE_OK #ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) if (!(MACHTYPE_OK (N_MACHTYPE (&exec))))
return NULL; return NULL;
#endif #endif

View File

@ -66,11 +66,11 @@ sparclinux_write_object_contents (bfd *abfd)
struct external_exec exec_bytes; struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd); struct internal_exec *execp = exec_hdr (abfd);
N_SET_MACHTYPE (*execp, M_SPARC); N_SET_MACHTYPE (execp, M_SPARC);
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
WRITE_HEADERS(abfd, execp); WRITE_HEADERS (abfd, execp);
return TRUE; return TRUE;
} }

View File

@ -120,8 +120,8 @@ NAME(lynx,set_arch_mach) (bfd *abfd, unsigned long machtype)
bfd_set_arch_mach (abfd, arch, machine); bfd_set_arch_mach (abfd, arch, machine);
} }
#define SET_ARCH_MACH(ABFD, EXEC) \ #define SET_ARCH_MACH(ABFD, EXECP) \
NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \
choose_reloc_size(ABFD); choose_reloc_size(ABFD);
/* Determine the size of a relocation entry, based on the architecture. */ /* Determine the size of a relocation entry, based on the architecture. */
@ -157,27 +157,27 @@ NAME(aout,sparclynx_write_object_contents) (bfd *abfd)
switch (bfd_get_mach (abfd)) switch (bfd_get_mach (abfd))
{ {
case bfd_mach_m68010: case bfd_mach_m68010:
N_SET_MACHTYPE (*execp, M_68010); N_SET_MACHTYPE (execp, M_68010);
break; break;
default: default:
case bfd_mach_m68020: case bfd_mach_m68020:
N_SET_MACHTYPE (*execp, M_68020); N_SET_MACHTYPE (execp, M_68020);
break; break;
} }
break; break;
case bfd_arch_sparc: case bfd_arch_sparc:
N_SET_MACHTYPE (*execp, M_SPARC); N_SET_MACHTYPE (execp, M_SPARC);
break; break;
case bfd_arch_i386: case bfd_arch_i386:
N_SET_MACHTYPE (*execp, M_386); N_SET_MACHTYPE (execp, M_386);
break; break;
default: default:
N_SET_MACHTYPE (*execp, M_UNKNOWN); N_SET_MACHTYPE (execp, M_UNKNOWN);
} }
choose_reloc_size (abfd); choose_reloc_size (abfd);
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);
WRITE_HEADERS (abfd, execp); WRITE_HEADERS (abfd, execp);

View File

@ -1,3 +1,8 @@
2015-12-01 Alan Modra <amodra@gmail.com>
* config/aout_gnu.h: Invoke aout N_* macros with pointer to
struct internal_exec.
2015-11-27 Matthew Wahab <matthew.wahab@arm.com> 2015-11-27 Matthew Wahab <matthew.wahab@arm.com>
* config/tc-aarch64.c (aarch64_features): Add "fp16". * config/tc-aarch64.c (aarch64_features): Add "fp16".

View File

@ -126,23 +126,23 @@ enum machine_type
M_HPUX23 = 0x020C /* hp200/300 HPUX binary */ M_HPUX23 = 0x020C /* hp200/300 HPUX binary */
}; };
#define N_MAGIC(exec) ((exec).a_info & 0xffff) #define N_MAGIC(execp) ((execp)->a_info & 0xffff)
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) #define N_MACHTYPE(execp) ((enum machine_type)(((execp)->a_info >> 16) & 0xff))
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) #define N_FLAGS(execp) (((execp)->a_info >> 24) & 0xff)
#define N_SET_INFO(exec, magic, type, flags) \ #define N_SET_INFO(execp, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \ ((execp)->a_info = ((magic) & 0xffff) \
| (((int)(type) & 0xff) << 16) \ | (((int)(type) & 0xff) << 16) \
| (((flags) & 0xff) << 24)) | (((flags) & 0xff) << 24))
#define N_SET_MAGIC(exec, magic) \ #define N_SET_MAGIC(execp, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) ((execp)->a_info = (((execp)->a_info & 0xffff0000) | ((magic) & 0xffff)))
#define N_SET_MACHTYPE(exec, machtype) \ #define N_SET_MACHTYPE(execp, machtype) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) ((execp)->a_info & 0xff00ffff) | ((((int) (machtype)) & 0xff) << 16))
#define N_SET_FLAGS(exec, flags) \ #define N_SET_FLAGS(execp, flags) \
((exec).a_info = \ ((execp)->a_info = \
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) ((execp)->a_info & 0x00ffffff) | (((flags) & 0xff) << 24))
/* Code indicating object file or impure executable. */ /* Code indicating object file or impure executable. */
#ifndef OMAGIC #ifndef OMAGIC
@ -185,23 +185,23 @@ enum machine_type
#endif #endif
#ifndef N_DATOFF #ifndef N_DATOFF
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) #define N_DATOFF(x) ( N_TXTOFF(x) + (x)->a_text )
#endif #endif
#ifndef N_TRELOFF #ifndef N_TRELOFF
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) #define N_TRELOFF(x) ( N_DATOFF(x) + (x)->a_data )
#endif #endif
#ifndef N_DRELOFF #ifndef N_DRELOFF
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) #define N_DRELOFF(x) ( N_TRELOFF(x) + (x)->a_trsize )
#endif #endif
#ifndef N_SYMOFF #ifndef N_SYMOFF
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) #define N_SYMOFF(x) ( N_DRELOFF(x) + (x)->a_drsize )
#endif #endif
#ifndef N_STROFF #ifndef N_STROFF
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) #define N_STROFF(x) ( N_SYMOFF(x) + (x)->a_syms )
#endif #endif
/* Address of text segment in memory after it is loaded. */ /* Address of text segment in memory after it is loaded. */
@ -211,12 +211,12 @@ enum machine_type
#ifndef N_DATADDR #ifndef N_DATADDR
#define N_DATADDR(x) \ #define N_DATADDR(x) \
(N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \ (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x)->a_text) \
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZE(x)-1)))) : (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x)->a_text-1) & ~(N_SEGSIZE(x)-1))))
#endif #endif
/* Address of bss segment in memory after it is loaded. */ /* Address of bss segment in memory after it is loaded. */
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) #define N_BSSADDR(x) (N_DATADDR(x) + (x)->a_data)
struct nlist struct nlist
{ {

View File

@ -1,3 +1,9 @@
2015-12-01 Alan Modra <amodra@gmail.com>
* bout.h: Invoke aout N_* macros with pointer to
struct internal_exec.
* os9k.h: Likewise.
2015-11-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2015-11-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* vtv-change-permission.h (VTV_PAGE_SIZE) [__sun__ && __svr4__ && * vtv-change-permission.h (VTV_PAGE_SIZE) [__sun__ && __svr4__ &&

View File

@ -1,3 +1,14 @@
2015-12-01 Alan Modra <amodra@gmail.com>
* adobe.h: Invoke aout N_* macros with pointer to
struct internal_exec.
* aout64.h: Likewise.
* dynix3.h: Likewise.
* encap.h: Likewise.
* hp.h: Likewise.
* hp300hpux.h: Likewise.
* sun4.h: Likewise.
2015-01-01 Alan Modra <amodra@gmail.com> 2015-01-01 Alan Modra <amodra@gmail.com>
Update year range in copyright notice of all files. Update year range in copyright notice of all files.

View File

@ -47,7 +47,7 @@ struct external_exec
#undef OMAGIC #undef OMAGIC
#undef NMAGIC #undef NMAGIC
#define N_BADMAG(x) ((x).a_info != ZMAGIC) #define N_BADMAG(x) ((x)->a_info != ZMAGIC)
/* By default, segment size is constant. But some machines override this /* By default, segment size is constant. But some machines override this
to be a function of the a.out header (e.g. machine type). */ to be a function of the a.out header (e.g. machine type). */
@ -77,25 +77,25 @@ struct internal_segdesc {
unsigned int a_filebase; /* Base address in object file */ unsigned int a_filebase; /* Base address in object file */
}; };
#define N_TXTADDR(x) \ #define N_TXTADDR(x) is_this_really_unused?
/* This is documented to be at 1024, but appears to really be at 2048. /* This is documented to be at 1024, but appears to really be at 2048.
FIXME?! */ FIXME?! */
#define N_TXTOFF(x) 2048 #define N_TXTOFF(x) 2048
#define N_TXTSIZE(x) ((x).a_text) #define N_TXTSIZE(x) ((x)->a_text)
#define N_DATADDR(x) #define N_DATADDR(x) is_this_really_unused?
#define N_BSSADDR(x) #define N_BSSADDR(x) is_this_really_unused?
/* Offsets of the various portions of the file after the text segment. */ /* Offsets of the various portions of the file after the text segment. */
#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) ) #define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) )
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) #define N_TRELOFF(x) ( N_DATOFF(x) + (x)->a_data )
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) #define N_DRELOFF(x) ( N_TRELOFF(x) + (x)->a_trsize )
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) #define N_SYMOFF(x) ( N_DRELOFF(x) + (x)->a_drsize )
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) #define N_STROFF(x) ( N_SYMOFF(x) + (x)->a_syms )
/* Symbols */ /* Symbols */
struct external_nlist { struct external_nlist {

View File

@ -136,7 +136,7 @@ struct external_exec
in the text. */ in the text. */
#ifndef N_HEADER_IN_TEXT #ifndef N_HEADER_IN_TEXT
#define N_HEADER_IN_TEXT(x) \ #define N_HEADER_IN_TEXT(x) \
(((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) (((x)->a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
#endif #endif
/* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC /* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC
@ -199,12 +199,12 @@ struct external_exec
#define N_TXTSIZE(x) \ #define N_TXTSIZE(x) \
(/* For QMAGIC, we don't consider the header part of the text section. */\ (/* For QMAGIC, we don't consider the header part of the text section. */\
N_IS_QMAGIC (x) \ N_IS_QMAGIC (x) \
? (x).a_text - EXEC_BYTES_SIZE \ ? (x)->a_text - EXEC_BYTES_SIZE \
: ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \ : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \
? (x).a_text \ ? (x)->a_text \
: (N_HEADER_IN_TEXT (x) \ : (N_HEADER_IN_TEXT (x) \
? (x).a_text - EXEC_BYTES_SIZE /* No padding. */ \ ? (x)->a_text - EXEC_BYTES_SIZE /* No padding. */ \
: (x).a_text /* A page of padding. */ ))) : (x)->a_text /* A page of padding. */ )))
#endif #endif
/* The address of the data segment in virtual memory. /* The address of the data segment in virtual memory.
It is the text segment address, plus text segment size, rounded It is the text segment address, plus text segment size, rounded
@ -218,7 +218,7 @@ struct external_exec
#endif #endif
/* The address of the BSS segment -- immediately after the data segment. */ /* The address of the BSS segment -- immediately after the data segment. */
#define N_BSSADDR(x) (N_DATADDR (x) + (x).a_data) #define N_BSSADDR(x) (N_DATADDR (x) + (x)->a_data)
/* Offsets of the various portions of the file after the text segment. */ /* Offsets of the various portions of the file after the text segment. */
@ -238,16 +238,16 @@ struct external_exec
#define N_DATOFF(x) (N_TXTOFF (x) + N_TXTSIZE (x)) #define N_DATOFF(x) (N_TXTOFF (x) + N_TXTSIZE (x))
#endif #endif
#ifndef N_TRELOFF #ifndef N_TRELOFF
#define N_TRELOFF(x) (N_DATOFF (x) + (x).a_data) #define N_TRELOFF(x) (N_DATOFF (x) + (x)->a_data)
#endif #endif
#ifndef N_DRELOFF #ifndef N_DRELOFF
#define N_DRELOFF(x) (N_TRELOFF (x) + (x).a_trsize) #define N_DRELOFF(x) (N_TRELOFF (x) + (x)->a_trsize)
#endif #endif
#ifndef N_SYMOFF #ifndef N_SYMOFF
#define N_SYMOFF(x) (N_DRELOFF (x) + (x).a_drsize) #define N_SYMOFF(x) (N_DRELOFF (x) + (x)->a_drsize)
#endif #endif
#ifndef N_STROFF #ifndef N_STROFF
#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms) #define N_STROFF(x) (N_SYMOFF (x) + (x)->a_syms)
#endif #endif
/* Symbols */ /* Symbols */

View File

@ -69,19 +69,19 @@ struct dynix_external_exec
#define N_TXTOFF(x) (EXEC_BYTES_SIZE) #define N_TXTOFF(x) (EXEC_BYTES_SIZE)
#define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x)) #define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x))
#define N_SHDATOFF(x) (N_DATOFF(x) + (x).a_data) #define N_SHDATOFF(x) (N_DATOFF(x) + (x)->a_data)
#define N_TRELOFF(x) (N_SHDATOFF(x) + (x).a_shdata) #define N_TRELOFF(x) (N_SHDATOFF(x) + (x)->a_shdata)
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) #define N_DRELOFF(x) (N_TRELOFF(x) + (x)->a_trsize)
#define N_SHDRELOFF(x) (N_DRELOFF(x) + (x).a_drsize) #define N_SHDRELOFF(x) (N_DRELOFF(x) + (x)->a_drsize)
#define N_SYMOFF(x) (N_SHDRELOFF(x) + (x).a_shdrsize) #define N_SYMOFF(x) (N_SHDRELOFF(x) + (x)->a_shdrsize)
#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) #define N_STROFF(x) (N_SYMOFF(x) + (x)->a_syms)
#define N_TXTADDR(x) \ #define N_TXTADDR(x) \
(((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \ (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \
: TEXT_START_ADDR + EXEC_BYTES_SIZE) : TEXT_START_ADDR + EXEC_BYTES_SIZE)
#define N_TXTSIZE(x) \ #define N_TXTSIZE(x) \
(((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x).a_text) \ (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x)->a_text) \
: ((x).a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE)) : ((x)->a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE))
#endif /* A_OUT_DYNIX3_H */ #endif /* A_OUT_DYNIX3_H */

View File

@ -131,5 +131,5 @@ short __header_offset_temp;
#define N_DATADDR(x) \ #define N_DATADDR(x) \
((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \ ((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \
(SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1))) : \ (SEGMENT_SIZE + ((N_TXTADDR(x)+(x)->a_text-1) & ~(SEGMENT_SIZE-1))) : \
(N_TXTADDR(x)+(x).a_text)) (N_TXTADDR(x)+(x)->a_text))

View File

@ -60,10 +60,10 @@ struct exec
#undef N_SET_MACHTYPE #undef N_SET_MACHTYPE
#undef N_SET_FLAGS #undef N_SET_FLAGS
#define N_MAGIC(exec) ((exec) . a_magic) #define N_MAGIC(execp) ((execp)->a_magic)
#define N_MACHTYPE(exec) ((exec) . a_machtype) #define N_MACHTYPE(execp) ((execp)->a_machtype)
#define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic)) #define N_SET_MAGIC(execp, magic) (((execp)->a_magic) = (magic))
#define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype)) #define N_SET_MACHTYPE(execp, machtype) (((execp)->a_machtype) = (machtype))
#undef N_BADMAG #undef N_BADMAG
#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) #define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x)))

View File

@ -113,18 +113,18 @@ struct hp300hpux_header_extension
#undef N_STROFF #undef N_STROFF
#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) ) #define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) )
#define N_PASOFF(x) ( N_DATOFF(x) + (x).a_data) #define N_PASOFF(x) ( N_DATOFF(x) + (x)->a_data)
#define N_SYMOFF(x) ( N_PASOFF(x) /* + (x).a_passize*/ ) #define N_SYMOFF(x) ( N_PASOFF(x) /* + (x)->a_passize*/ )
#define N_SUPOFF(x) ( N_SYMOFF(x) + (x).a_syms ) #define N_SUPOFF(x) ( N_SYMOFF(x) + (x)->a_syms )
#define N_TRELOFF(x) ( N_SUPOFF(x) /* + 0 (x).a_supsize*/ ) #define N_TRELOFF(x) ( N_SUPOFF(x) /* + (x)->a_supsize*/ )
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) #define N_DRELOFF(x) ( N_TRELOFF(x) + (x)->a_trsize )
#define N_EXTHOFF(x) ( N_DRELOFF(x) /* + 0 (x).a_drsize */) #define N_EXTHOFF(x) ( N_DRELOFF(x) /* + (x)->a_drsize */)
#define N_STROFF(x) ( 0 /* no string table */ ) #define N_STROFF(x) ( 0 /* no string table */ )
/* use these when the file has gnu symbol tables */ /* use these when the file has gnu symbol tables */
#define N_GNU_TRELOFF(x) (N_DATOFF(x) + (x).a_data) #define N_GNU_TRELOFF(x) (N_DATOFF(x) + (x)->a_data)
#define N_GNU_DRELOFF(x) (N_GNU_TRELOFF(x) + (x).a_trsize) #define N_GNU_DRELOFF(x) (N_GNU_TRELOFF(x) + (x)->a_trsize)
#define N_GNU_SYMOFF(x) (N_GNU_DRELOFF(x) + (x).a_drsize) #define N_GNU_SYMOFF(x) (N_GNU_DRELOFF(x) + (x)->a_drsize)
#define TARGET_PAGE_SIZE 0x1000 #define TARGET_PAGE_SIZE 0x1000
#define SEGMENT_SIZE 0x1000 #define SEGMENT_SIZE 0x1000

View File

@ -44,8 +44,8 @@
expected text address. These kludges have gotta go! expected text address. These kludges have gotta go!
For linked files, should reflect reality if we know it. */ For linked files, should reflect reality if we know it. */
#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR \ #define N_SHARED_LIB(x) ((x)->a_entry < TEXT_START_ADDR \
&& (x).a_text >= EXEC_BYTES_SIZE) && (x)->a_text >= EXEC_BYTES_SIZE)
/* This differs from the version in aout64.h (which we override by defining /* This differs from the version in aout64.h (which we override by defining
it here) only for NMAGIC (we return TEXT_START_ADDR+EXEC_BYTES_SIZE; it here) only for NMAGIC (we return TEXT_START_ADDR+EXEC_BYTES_SIZE;
@ -53,7 +53,7 @@
#define N_TXTADDR(x) \ #define N_TXTADDR(x) \
(N_MAGIC(x)==OMAGIC? 0 \ (N_MAGIC(x)==OMAGIC? 0 \
: (N_MAGIC(x) == ZMAGIC && (x).a_entry < TEXT_START_ADDR)? 0 \ : (N_MAGIC(x) == ZMAGIC && (x)->a_entry < TEXT_START_ADDR)? 0 \
: TEXT_START_ADDR+EXEC_BYTES_SIZE) : TEXT_START_ADDR+EXEC_BYTES_SIZE)
/* When a file is linked against a shared library on SunOS 4, the /* When a file is linked against a shared library on SunOS 4, the

View File

@ -87,16 +87,16 @@ struct external_exec
/* These macros use the a_xxx field names, since they operate on the exec /* These macros use the a_xxx field names, since they operate on the exec
structure after it's been byte-swapped and realigned on the host machine. */ structure after it's been byte-swapped and realigned on the host machine. */
#define N_BADMAG(x) (((x).a_info)!=BMAGIC) #define N_BADMAG(x) (((x)->a_info)!=BMAGIC)
#define N_TXTOFF(x) EXEC_BYTES_SIZE #define N_TXTOFF(x) EXEC_BYTES_SIZE
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) #define N_DATOFF(x) ( N_TXTOFF(x) + (x)->a_text )
#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) #define N_TROFF(x) ( N_DATOFF(x) + (x)->a_data )
#define N_TRELOFF N_TROFF #define N_TRELOFF N_TROFF
#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize ) #define N_DROFF(x) ( N_TROFF(x) + (x)->a_trsize )
#define N_DRELOFF N_DROFF #define N_DRELOFF N_DROFF
#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize ) #define N_SYMOFF(x) ( N_DROFF(x) + (x)->a_drsize )
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) #define N_STROFF(x) ( N_SYMOFF(x) + (x)->a_syms )
#define N_DATADDR(x) ( (x).a_dload ) #define N_DATADDR(x) ( (x)->a_dload )
/* Address of text segment in memory after it is loaded. */ /* Address of text segment in memory after it is loaded. */
#if !defined (N_TXTADDR) #if !defined (N_TXTADDR)

View File

@ -100,7 +100,7 @@ Boston, MA 02110-1301, USA. */
#define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size) #define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size)
#endif /* 0 */ #endif /* 0 */
#define MHCOM_BYTES_SIZE 80 #define MHCOM_BYTES_SIZE 80
#define N_BADMAG(a) (((a).a_info) != MODSYNC) #define N_BADMAG(a) (((a)->a_info) != MODSYNC)
typedef struct mh_com typedef struct mh_com
{ {