diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 30 | ||||
-rw-r--r-- | bfd/aout-adobe.c | 18 | ||||
-rw-r--r-- | bfd/aout-arm.c | 10 | ||||
-rw-r--r-- | bfd/aout-cris.c | 10 | ||||
-rw-r--r-- | bfd/aout-target.h | 32 | ||||
-rw-r--r-- | bfd/aout-tic30.c | 32 | ||||
-rw-r--r-- | bfd/aoutf1.h | 28 | ||||
-rw-r--r-- | bfd/aoutx.h | 42 | ||||
-rw-r--r-- | bfd/bout.c | 20 | ||||
-rw-r--r-- | bfd/freebsd.h | 58 | ||||
-rw-r--r-- | bfd/gen-aout.c | 2 | ||||
-rw-r--r-- | bfd/hp300hpux.c | 38 | ||||
-rw-r--r-- | bfd/i386aout.c | 4 | ||||
-rw-r--r-- | bfd/i386linux.c | 4 | ||||
-rw-r--r-- | bfd/i386lynx.c | 6 | ||||
-rw-r--r-- | bfd/i386mach3.c | 2 | ||||
-rw-r--r-- | bfd/i386os9k.c | 6 | ||||
-rw-r--r-- | bfd/libaout.h | 40 | ||||
-rw-r--r-- | bfd/m68klinux.c | 4 | ||||
-rw-r--r-- | bfd/m88kmach3.c | 2 | ||||
-rw-r--r-- | bfd/mipsbsd.c | 20 | ||||
-rw-r--r-- | bfd/netbsd.h | 28 | ||||
-rw-r--r-- | bfd/pc532-mach.c | 12 | ||||
-rw-r--r-- | bfd/pdp11.c | 54 | ||||
-rw-r--r-- | bfd/riscix.c | 36 | ||||
-rw-r--r-- | bfd/sparclinux.c | 4 | ||||
-rw-r--r-- | bfd/sparclynx.c | 16 |
27 files changed, 294 insertions, 264 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eb5cf11..0fbdd64 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,35 @@ 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> + * coff-rs6000.c (_bfd_xcoff_put_symbol_name): Replace abfd param with info param. Test info->traditional_format rather than BFD_TRADITIONAL_FORMAT flag. diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 7e781d4..3e64c1a 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -86,8 +86,8 @@ aout_adobe_callback (bfd *abfd) bfd_set_arch_mach (abfd, bfd_arch_unknown, 0L); /* The positions of the string table and symbol table. */ - obj_str_filepos (abfd) = N_STROFF (*execp); - obj_sym_filepos (abfd) = N_SYMOFF (*execp); + obj_str_filepos (abfd) = N_STROFF (execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); /* Suck up the section information from the file, one section at a time. */ for (;;) @@ -166,12 +166,12 @@ aout_adobe_callback (bfd *abfd) switch (ext->e_type[0]) { case N_TEXT: - sect->rel_filepos = N_TRELOFF (*execp); + sect->rel_filepos = N_TRELOFF (execp); sect->reloc_count = execp->a_trsize; break; case N_DATA: - sect->rel_filepos = N_DRELOFF (*execp); + sect->rel_filepos = N_DRELOFF (execp); sect->reloc_count = execp->a_drsize; break; @@ -213,7 +213,7 @@ aout_adobe_object_p (bfd *abfd) 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! */ - if (N_BADMAG (anexec)) + if (N_BADMAG (&anexec)) { targ = getenv ("GNUTARGET"); 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. */ 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) return FALSE; if (! aout_32_write_syms (abfd)) 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) return FALSE; @@ -349,7 +349,7 @@ aout_adobe_write_object_contents (bfd *abfd) if (!aout_32_squirt_out_relocs (abfd, sect)) 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) return FALSE; @@ -377,7 +377,7 @@ aout_adobe_set_section_contents (bfd *abfd, { /* Assign file offsets to sections. Text sections are first, and 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) { diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index 9e5bb8f..a1c13fe 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -34,7 +34,7 @@ : ((N_MAGIC (x) != ZMAGIC) \ ? (bfd_vma) 0 \ : ((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))) #define TEXT_START_ADDR 0x8000 @@ -43,10 +43,10 @@ #define DEFAULT_ARCH bfd_arch_arm #define MY(OP) CONCAT2 (arm_aout_,OP) -#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ - (((x).a_info & ~006000) != OMAGIC) && \ - ((x).a_info != NMAGIC)) -#define N_MAGIC(x) ((x).a_info & ~07200) +#define N_BADMAG(x) ((((x)->a_info & ~007200) != ZMAGIC) && \ + (((x)->a_info & ~006000) != OMAGIC) && \ + ((x)->a_info != NMAGIC)) +#define N_MAGIC(x) ((x)->a_info & ~07200) #define MY_bfd_reloc_type_lookup arm_aout_bfd_reloc_type_lookup #define MY_bfd_reloc_name_lookup arm_aout_bfd_reloc_name_lookup diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c index 166e305..5280824 100644 --- a/bfd/aout-cris.c +++ b/bfd/aout-cris.c @@ -37,7 +37,7 @@ 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 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. */ #define SEGMENT_SIZE 2 @@ -93,8 +93,8 @@ static bfd_boolean MY (set_sizes) (bfd *); not call set_sizes. */ #define MY_set_arch_mach NAME (aout, set_arch_mach) -#define SET_ARCH_MACH(BFD, EXEC) \ - MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXEC)) +#define SET_ARCH_MACH(BFD, EXECP) \ + MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXECP)) /* These macros describe the binary layout of the reloc information we 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 the default definition. */ 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); diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 0c97a4a..a0e1494 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -42,12 +42,12 @@ MY (callback) (bfd *abfd) unsigned long arch_align; /* 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. */ - obj_textsec (abfd)->vma = N_TXTADDR (*execp); - obj_datasec (abfd)->vma = N_DATADDR (*execp); - obj_bsssec (abfd)->vma = N_BSSADDR (*execp); + obj_textsec (abfd)->vma = N_TXTADDR (execp); + obj_datasec (abfd)->vma = N_DATADDR (execp); + obj_bsssec (abfd)->vma = N_BSSADDR (execp); /* 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. @@ -71,20 +71,20 @@ MY (callback) (bfd *abfd) obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; /* The file offsets of the sections. */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (execp); + obj_datasec (abfd)->filepos = N_DATOFF (execp); /* The file offsets of the relocation info. */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); + obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); /* The file offsets of the string table and symbol table. */ - obj_sym_filepos (abfd) = N_SYMOFF (*execp); - obj_str_filepos (abfd) = N_STROFF (*execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); + obj_str_filepos (abfd) = N_STROFF (execp); /* Determine the architecture and machine type of the object file. */ #ifdef SET_ARCH_MACH - SET_ARCH_MACH (abfd, *execp); + SET_ARCH_MACH (abfd, execp); #else bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); #endif @@ -149,11 +149,11 @@ MY (object_p) (bfd *abfd) exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info); #endif - if (N_BADMAG (exec)) + if (N_BADMAG (&exec)) return 0; #ifdef MACHTYPE_OK - if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) + if (!(MACHTYPE_OK (N_MACHTYPE (&exec)))) return 0; #endif @@ -332,9 +332,9 @@ MY_final_link_callback (bfd *abfd, { struct internal_exec *execp = exec_hdr (abfd); - *ptreloff = N_TRELOFF (*execp); - *pdreloff = N_DRELOFF (*execp); - *psymoff = N_SYMOFF (*execp); + *ptreloff = N_TRELOFF (execp); + *pdreloff = N_DRELOFF (execp); + *psymoff = N_SYMOFF (execp); } #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 7fcdf62..6852c85 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -339,32 +339,32 @@ tic30_aout_callback (bfd *abfd) unsigned long arch_align; /* 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. */ - obj_textsec (abfd)->vma = N_TXTADDR (*execp); - obj_datasec (abfd)->vma = N_DATADDR (*execp); - obj_bsssec (abfd)->vma = N_BSSADDR (*execp); + obj_textsec (abfd)->vma = N_TXTADDR (execp); + obj_datasec (abfd)->vma = N_DATADDR (execp); + obj_bsssec (abfd)->vma = N_BSSADDR (execp); obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; /* The file offsets of the sections. */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (execp); + obj_datasec (abfd)->filepos = N_DATOFF (execp); /* The file offsets of the relocation info. */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); + obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); /* The file offsets of the string table and symbol table. */ - obj_sym_filepos (abfd) = N_SYMOFF (*execp); - obj_str_filepos (abfd) = N_STROFF (*execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); + obj_str_filepos (abfd) = N_STROFF (execp); /* Determine the architecture and machine type of the object file. */ #ifdef SET_ARCH_MACH - SET_ARCH_MACH (abfd, *execp); + SET_ARCH_MACH (abfd, execp); #else bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L); #endif @@ -568,10 +568,10 @@ tic30_aout_object_p (bfd *abfd) exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); #endif /* SWAP_MAGIC */ - if (N_BADMAG (exec)) + if (N_BADMAG (&exec)) return 0; #ifdef MACHTYPE_OK - if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) + if (!(MACHTYPE_OK (N_MACHTYPE (&exec)))) return 0; #endif @@ -664,19 +664,19 @@ tic30_aout_write_object_contents (bfd *abfd) if (bfd_get_outsymbols (abfd) != (asymbol **) NULL && 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; if (!NAME (aout, write_syms) (abfd)) 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; if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) 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; if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) return FALSE; diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h index 7f48835..97e122b 100644 --- a/bfd/aoutf1.h +++ b/bfd/aoutf1.h @@ -155,8 +155,8 @@ sunos_set_arch_mach (bfd *abfd, enum machine_type machtype) bfd_set_arch_mach (abfd, arch, machine); } -#define SET_ARCH_MACH(ABFD, EXEC) \ - NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ +#define SET_ARCH_MACH(ABFD, EXECP) \ + NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \ choose_reloc_size(ABFD); /* 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)) { case bfd_mach_m68000: - N_SET_MACHTYPE (*execp, M_UNKNOWN); + N_SET_MACHTYPE (execp, M_UNKNOWN); break; case bfd_mach_m68010: - N_SET_MACHTYPE (*execp, M_68010); + N_SET_MACHTYPE (execp, M_68010); break; default: case bfd_mach_m68020: - N_SET_MACHTYPE (*execp, M_68020); + N_SET_MACHTYPE (execp, M_68020); break; } break; @@ -209,28 +209,28 @@ sunos_write_object_contents (bfd *abfd) switch (bfd_get_mach (abfd)) { case bfd_mach_sparc_sparclet: - N_SET_MACHTYPE (*execp, M_SPARCLET); + N_SET_MACHTYPE (execp, M_SPARCLET); break; case bfd_mach_sparc_sparclite_le: - N_SET_MACHTYPE (*execp, M_SPARCLITE_LE); + N_SET_MACHTYPE (execp, M_SPARCLITE_LE); break; default: - N_SET_MACHTYPE (*execp, M_SPARC); + N_SET_MACHTYPE (execp, M_SPARC); break; } break; case bfd_arch_i386: - N_SET_MACHTYPE (*execp, M_386); + N_SET_MACHTYPE (execp, M_386); break; default: - N_SET_MACHTYPE (*execp, M_UNKNOWN); + N_SET_MACHTYPE (execp, M_UNKNOWN); } 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); @@ -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_tsize = H_GET_32 (abfd, &extcore->c_tsize); 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); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); 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_tsize = H_GET_32 (abfd, &extcore->c_tsize); 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); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = offsetof (struct external_sparc_core, fp_stuff); diff --git a/bfd/aoutx.h b/bfd/aoutx.h index f78b910..cca386a 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -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. */ if (execp->a_syms) abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; - if (N_DYNAMIC (*execp)) + if (N_DYNAMIC (execp)) abfd->flags |= DYNAMIC; - if (N_MAGIC (*execp) == ZMAGIC) + if (N_MAGIC (execp) == ZMAGIC) { abfd->flags |= D_PAGED | WP_TEXT; adata (abfd).magic = z_magic; } - else if (N_MAGIC (*execp) == QMAGIC) + else if (N_MAGIC (execp) == QMAGIC) { abfd->flags |= D_PAGED | WP_TEXT; adata (abfd).magic = z_magic; adata (abfd).subformat = q_magic_format; } - else if (N_MAGIC (*execp) == NMAGIC) + else if (N_MAGIC (execp) == NMAGIC) { abfd->flags |= WP_TEXT; adata (abfd).magic = n_magic; } - else if (N_MAGIC (*execp) == OMAGIC - || N_MAGIC (*execp) == BMAGIC) + else if (N_MAGIC (execp) == OMAGIC + || N_MAGIC (execp) == BMAGIC) adata (abfd).magic = o_magic; else /* 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); - 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. */ /* The virtual memory addresses of the sections. */ - obj_textsec (abfd)->vma = N_TXTADDR (*execp); - obj_datasec (abfd)->vma = N_DATADDR (*execp); - obj_bsssec (abfd)->vma = N_BSSADDR (*execp); + obj_textsec (abfd)->vma = N_TXTADDR (execp); + obj_datasec (abfd)->vma = N_DATADDR (execp); + obj_bsssec (abfd)->vma = N_BSSADDR (execp); /* The file offsets of the sections. */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (execp); + obj_datasec (abfd)->filepos = N_DATOFF (execp); /* The file offsets of the relocation info. */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); + obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); /* The file offsets of the string table and symbol table. */ - obj_str_filepos (abfd) = N_STROFF (*execp); - obj_sym_filepos (abfd) = N_SYMOFF (*execp); + obj_str_filepos (abfd) = N_STROFF (execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); /* Determine the architecture and machine type of the object file. */ - switch (N_MACHTYPE (*exec_hdr (abfd))) + switch (N_MACHTYPE (exec_hdr (abfd))) { default: 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_data = obj_datasec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size; - N_SET_MAGIC (*execp, OMAGIC); + N_SET_MAGIC (execp, OMAGIC); } static void @@ -1038,9 +1038,9 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp) if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) execp->a_text += adata (abfd).exec_bytes_size; if (obj_aout_subformat (abfd) == q_magic_format) - N_SET_MAGIC (*execp, QMAGIC); + N_SET_MAGIC (execp, QMAGIC); else - N_SET_MAGIC (*execp, ZMAGIC); + N_SET_MAGIC (execp, ZMAGIC); /* Spec says data section should be rounded up to page boundary. */ 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_data = obj_datasec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size; - N_SET_MAGIC (*execp, NMAGIC); + N_SET_MAGIC (execp, NMAGIC); } bfd_boolean @@ -137,8 +137,8 @@ b_out_callback (bfd *abfd) ); /* The positions of the string table and symbol table. */ - obj_str_filepos (abfd) = N_STROFF (*execp); - obj_sym_filepos (abfd) = N_SYMOFF (*execp); + obj_str_filepos (abfd) = N_STROFF (execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); /* The alignments of the sections. */ 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; /* The file positions of the sections. */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (execp); + obj_datasec (abfd)->filepos = N_DATOFF (execp); /* The file positions of the relocation info. */ - obj_textsec (abfd)->rel_filepos = N_TROFF (*execp); - obj_datasec (abfd)->rel_filepos = N_DROFF (*execp); + obj_textsec (abfd)->rel_filepos = N_TROFF (execp); + obj_datasec (abfd)->rel_filepos = N_DROFF (execp); adata (abfd).page_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); - if (N_BADMAG (anexec)) + if (N_BADMAG (&anexec)) { bfd_set_error (bfd_error_wrong_format); return 0; @@ -450,20 +450,20 @@ b_out_write_object_contents (bfd *abfd) b_out_symbol_cmp); /* 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) return FALSE; if (! aout_32_write_syms (abfd)) 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) return FALSE; if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) 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) return FALSE; diff --git a/bfd/freebsd.h b/bfd/freebsd.h index 62d9682..4a180b1 100644 --- a/bfd/freebsd.h +++ b/bfd/freebsd.h @@ -25,31 +25,31 @@ /* ZMAGIC files start at offset 0. Does not apply to QMAGIC files. */ #define TEXT_START_ADDR 0 -#define N_GETMAGIC_NET(exec) \ - ((exec).a_info & 0xffff) -#define N_GETMID_NET(exec) \ - (((exec).a_info >> 16) & 0x3ff) -#define N_GETFLAG_NET(ex) \ - (((exec).a_info >> 26) & 0x3f) - -#define N_MACHTYPE(exec) \ +#define N_GETMAGIC_NET(execp) \ + ((execp)->a_info & 0xffff) +#define N_GETMID_NET(execp) \ + (((execp)->a_info >> 16) & 0x3ff) +#define N_GETFLAG_NET(exexp) \ + (((execp)->a_info >> 26) & 0x3f) + +#define N_MACHTYPE(execp) \ ((enum machine_type) \ - ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETMID_NET (exec) : \ - ((exec).a_info >> 16) & 0x3ff)) -#define N_FLAGS(exec) \ - ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETFLAG_NET (exec) : \ - ((exec).a_info >> 26) & 0x3f) - -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ + ((N_GETMAGIC_NET (execp) == ZMAGIC) ? N_GETMID_NET (execp) : \ + ((execp)->a_info >> 16) & 0x3ff)) +#define N_FLAGS(execp) \ + ((N_GETMAGIC_NET (execp) == ZMAGIC) ? N_GETFLAG_NET (execp) : \ + ((execp)->a_info >> 26) & 0x3f) + +#define N_SET_INFO(execp, magic, type, flags) \ + ((execp)->a_info = ((magic) & 0xffff) \ | (((int)(type) & 0x3ff) << 16) \ | (((flags) & 0x3f) << 26)) -#define N_SET_MACHTYPE(exec, machtype) \ - ((exec).a_info = \ - ((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) -#define N_SET_FLAGS(exec, flags) \ - ((exec).a_info = \ - ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) +#define N_SET_MACHTYPE(execp, machtype) \ + ((execp)->a_info = \ + ((execp)->a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) +#define N_SET_FLAGS(execp, flags) \ + ((execp)->a_info = \ + ((execp)->a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) #include "sysdep.h" #include "bfd.h" @@ -82,25 +82,25 @@ MY (write_object_contents) (bfd *abfd) { case bfd_arch_m68k: 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 - N_SET_MACHTYPE (*execp, M_68K_NETBSD); + N_SET_MACHTYPE (execp, M_68K_NETBSD); break; case bfd_arch_sparc: - N_SET_MACHTYPE (*execp, M_SPARC_NETBSD); + N_SET_MACHTYPE (execp, M_SPARC_NETBSD); break; case bfd_arch_i386: - N_SET_MACHTYPE (*execp, M_386_NETBSD); + N_SET_MACHTYPE (execp, M_386_NETBSD); break; case bfd_arch_ns32k: - N_SET_MACHTYPE (*execp, M_532_NETBSD); + N_SET_MACHTYPE (execp, M_532_NETBSD); break; default: - N_SET_MACHTYPE (*execp, M_UNKNOWN); + N_SET_MACHTYPE (execp, M_UNKNOWN); break; } - WRITE_HEADERS(abfd, execp); + WRITE_HEADERS (abfd, execp); return TRUE; } diff --git a/bfd/gen-aout.c b/bfd/gen-aout.c index f7f0edd..44c8479 100644 --- a/bfd/gen-aout.c +++ b/bfd/gen-aout.c @@ -57,7 +57,7 @@ main (int argc, char** argv) fclose (file); #ifdef N_TXTOFF - page_size = N_TXTOFF(my_exec); + page_size = N_TXTOFF (&my_exec); if (page_size == 0) printf ("#define N_HEADER_IN_TEXT(x) 1\n"); else diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c index 8bb58c9..564cdc2 100644 --- a/bfd/hp300hpux.c +++ b/bfd/hp300hpux.c @@ -224,32 +224,32 @@ MY (callback) (bfd *abfd) struct internal_exec *execp = exec_hdr (abfd); /* 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 */ - obj_textsec (abfd)->vma = N_TXTADDR (*execp); - obj_datasec (abfd)->vma = N_DATADDR (*execp); - obj_bsssec (abfd)->vma = N_BSSADDR (*execp); + obj_textsec (abfd)->vma = N_TXTADDR (execp); + obj_datasec (abfd)->vma = N_DATADDR (execp); + obj_bsssec (abfd)->vma = N_BSSADDR (execp); obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; /* The file offsets of the sections */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (execp); + obj_datasec (abfd)->filepos = N_DATOFF (execp); /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); + obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); /* The file offsets of the string table and symbol table. */ - obj_sym_filepos (abfd) = N_SYMOFF (*execp); - obj_str_filepos (abfd) = N_STROFF (*execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); + obj_str_filepos (abfd) = N_STROFF (execp); /* Determine the architecture and machine type of the object file. */ #ifdef SET_ARCH_MACH - SET_ARCH_MACH (abfd, *execp); + SET_ARCH_MACH (abfd, execp); #else bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); #endif @@ -257,11 +257,11 @@ MY (callback) (bfd *abfd) if (obj_aout_subformat (abfd) == gnu_encap_format) { /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF (*execp); - obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF (*execp); + obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF (execp); + obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF (execp); /* 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); 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) * obj_reloc_entry_size (abfd)); - N_SET_MACHTYPE (*execp, 0xc); - N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); + N_SET_MACHTYPE (execp, 0xc); + N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags); 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) { /* 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) return FALSE; } @@ -329,11 +329,11 @@ MY (write_object_contents) (bfd * abfd) 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; if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) 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; if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) return FALSE; diff --git a/bfd/i386aout.c b/bfd/i386aout.c index 59e1ed2..3f40fb1 100644 --- a/bfd/i386aout.c +++ b/bfd/i386aout.c @@ -28,7 +28,7 @@ #define N_HEADER_IN_TEXT(x) 0 #define N_TXTOFF(x) 0x20 #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 SEGMENT_SIZE 0x400000 #define DEFAULT_ARCH bfd_arch_i386 @@ -54,7 +54,7 @@ i386aout_write_object_contents (bfd *abfd) struct external_exec exec_bytes; 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; diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 2bec98b..084dfb9 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -70,11 +70,11 @@ i386linux_write_object_contents (bfd *abfd) struct external_exec exec_bytes; 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; - WRITE_HEADERS(abfd, execp); + WRITE_HEADERS (abfd, execp); return TRUE; } diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c index 075d1c0..91cac43 100644 --- a/bfd/i386lynx.c +++ b/bfd/i386lynx.c @@ -58,19 +58,19 @@ \ 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) \ 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) \ return FALSE; \ \ if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ 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) \ return 0; \ \ diff --git a/bfd/i386mach3.c b/bfd/i386mach3.c index aa573f4..582a13d 100644 --- a/bfd/i386mach3.c +++ b/bfd/i386mach3.c @@ -32,7 +32,7 @@ /* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */ #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 "bfd.h" diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 889c2ad..a0b3384 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -103,8 +103,8 @@ os9k_callback (bfd *abfd) obj_datasec (abfd)->filepos = execp->a_dload; /* The file positions of the relocation info *** - obj_textsec (abfd)->rel_filepos = N_TROFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DROFF(*execp); */ + obj_textsec (abfd)->rel_filepos = N_TROFF (execp); + obj_datasec (abfd)->rel_filepos = N_DROFF (execp); */ adata (abfd).page_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); - if (N_BADMAG (anexec)) + if (N_BADMAG (&anexec)) { bfd_set_error (bfd_error_wrong_format); return 0; diff --git a/bfd/libaout.h b/bfd/libaout.h index f1f6015..9f32cc8 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -291,48 +291,48 @@ enum machine_type 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 -# define N_MAGIC(exec) ((exec).a_info & 0xffff) +# define N_MAGIC(execp) ((execp)->a_info & 0xffff) #endif #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 #ifndef N_FLAGS -# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) +# define N_FLAGS(execp) (((execp)->a_info >> 24) & 0xff) #endif #ifndef N_SET_INFO -# define N_SET_INFO(exec, magic, type, flags) \ -((exec).a_info = ((magic) & 0xffff) \ +# define N_SET_INFO(execp, magic, type, flags) \ +((execp)->a_info = ((magic) & 0xffff) \ | (((int)(type) & 0xff) << 16) \ | (((flags) & 0xff) << 24)) #endif #ifndef N_SET_DYNAMIC -# define N_SET_DYNAMIC(exec, dynamic) \ -((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \ -((exec).a_info & 0x7fffffff)) +# define N_SET_DYNAMIC(execp, dynamic) \ +((execp)->a_info = (dynamic) ? (long) ((execp)->a_info | 0x80000000) : \ +((execp)->a_info & 0x7fffffff)) #endif #ifndef N_SET_MAGIC -# define N_SET_MAGIC(exec, magic) \ -((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) +# define N_SET_MAGIC(execp, magic) \ +((execp)->a_info = (((execp)->a_info & 0xffff0000) | ((magic) & 0xffff))) #endif #ifndef N_SET_MACHTYPE -# define N_SET_MACHTYPE(exec, machtype) \ -((exec).a_info = \ - ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) +# define N_SET_MACHTYPE(execp, machtype) \ +((execp)->a_info = \ + ((execp)->a_info & 0xff00ffff) | ((((int) (machtype)) &0xff) << 16)) #endif #ifndef N_SET_FLAGS -# define N_SET_FLAGS(exec, flags) \ -((exec).a_info = \ - ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) +# define N_SET_FLAGS(execp, flags) \ +((execp)->a_info = \ + ((execp)->a_info & 0x00ffffff) | (((flags) & 0xff) << 24)) #endif typedef struct aout_symbol @@ -648,19 +648,19 @@ extern bfd_boolean NAME (aout, bfd_free_cached_info) if (bfd_get_outsymbols (abfd) != NULL \ && 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; \ \ if (! NAME (aout, write_syms) (abfd)) \ 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; \ if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \ 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; \ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ return FALSE; \ diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index a29cf2b..291a58f 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -69,11 +69,11 @@ m68klinux_write_object_contents (bfd *abfd) struct external_exec exec_bytes; 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; - WRITE_HEADERS(abfd, execp); + WRITE_HEADERS (abfd, execp); return TRUE; } diff --git a/bfd/m88kmach3.c b/bfd/m88kmach3.c index 783a958..8c351c1 100644 --- a/bfd/m88kmach3.c +++ b/bfd/m88kmach3.c @@ -23,7 +23,7 @@ #define TEXT_START_ADDR 0 #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 "bfd.h" diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 5ea89b6..c969095 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -23,7 +23,7 @@ /* #define ENTRY_CAN_BE_ZERO */ #define N_HEADER_IN_TEXT(x) 1 #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 */\ ) #define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x)) @@ -45,8 +45,8 @@ #include "libbfd.h" #include "libaout.h" -#define SET_ARCH_MACH(ABFD, EXEC) \ - MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ +#define SET_ARCH_MACH(ABFD, EXECP) \ + MY(set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \ MY(choose_reloc_size) (ABFD); static void MY(set_arch_mach) (bfd *, unsigned long); static void MY(choose_reloc_size) (bfd *); @@ -137,34 +137,34 @@ MY (write_object_contents) (bfd *abfd) switch (bfd_get_mach (abfd)) { case bfd_mach_m68010: - N_SET_MACHTYPE (*execp, M_68010); + N_SET_MACHTYPE (execp, M_68010); break; default: case bfd_mach_m68020: - N_SET_MACHTYPE (*execp, M_68020); + N_SET_MACHTYPE (execp, M_68020); break; } break; case bfd_arch_sparc: - N_SET_MACHTYPE (*execp, M_SPARC); + N_SET_MACHTYPE (execp, M_SPARC); break; case bfd_arch_i386: - N_SET_MACHTYPE (*execp, M_386); + N_SET_MACHTYPE (execp, M_386); break; case bfd_arch_mips: switch (bfd_get_mach (abfd)) { case bfd_mach_mips4000: case bfd_mach_mips6000: - N_SET_MACHTYPE (*execp, M_MIPS2); + N_SET_MACHTYPE (execp, M_MIPS2); break; default: - N_SET_MACHTYPE (*execp, M_MIPS1); + N_SET_MACHTYPE (execp, M_MIPS1); break; } break; default: - N_SET_MACHTYPE (*execp, M_UNKNOWN); + N_SET_MACHTYPE (execp, M_UNKNOWN); } MY (choose_reloc_size) (abfd); diff --git a/bfd/netbsd.h b/bfd/netbsd.h index a53b581..abd5fe7 100644 --- a/bfd/netbsd.h +++ b/bfd/netbsd.h @@ -34,21 +34,21 @@ #define N_SHARED_LIB(x) (N_DYNAMIC (x)) /* We have 6 bits of flags and 10 bits of machine ID. */ -#define N_MACHTYPE(exec) \ - ((enum machine_type) (((exec).a_info >> 16) & 0x03ff)) -#define N_FLAGS(exec) \ - (((exec).a_info >> 26) & 0x3f) +#define N_MACHTYPE(execp) \ + ((enum machine_type) (((execp)->a_info >> 16) & 0x03ff)) +#define N_FLAGS(execp) \ + (((execp)->a_info >> 26) & 0x3f) -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ +#define N_SET_INFO(execp, magic, type, flags) \ + ((execp)->a_info = ((magic) & 0xffff) \ | (((int) (type) & 0x3ff) << 16) \ | (((flags) & 0x3f) << 24)) -#define N_SET_MACHTYPE(exec, machtype) \ - ((exec).a_info = \ - ((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) -#define N_SET_FLAGS(exec, flags) \ - ((exec).a_info = \ - ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) +#define N_SET_MACHTYPE(execp, machtype) \ + ((execp)->a_info = \ + ((execp)->a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) +#define N_SET_FLAGS(execp, flags) \ + ((execp)->a_info = \ + ((execp)->a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) #include "sysdep.h" #include "bfd.h" @@ -97,10 +97,10 @@ MY (write_object_contents) (bfd *abfd) switch (bfd_get_arch(abfd)) { case DEFAULT_ARCH: - N_SET_MACHTYPE(*execp, DEFAULT_MID); + N_SET_MACHTYPE (execp, DEFAULT_MID); break; default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); + N_SET_MACHTYPE (execp, M_UNKNOWN); break; } diff --git a/bfd/pc532-mach.c b/bfd/pc532-mach.c index 191ca21..98c6644 100644 --- a/bfd/pc532-mach.c +++ b/bfd/pc532-mach.c @@ -31,7 +31,7 @@ 1 and specially define our own N_TXTSIZE. */ #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 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 */ #define N_TXTADDR(x) \ (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: \ TEXT_START_ADDR + EXEC_BYTES_SIZE)) @@ -89,16 +89,16 @@ MY(write_object_contents) (bfd *abfd) switch (bfd_get_mach (abfd)) { case 32032: - N_SET_MACHTYPE (*execp, M_NS32032); + N_SET_MACHTYPE (execp, M_NS32032); break; case 32532: default: - N_SET_MACHTYPE (*execp, M_NS32532); + N_SET_MACHTYPE (execp, M_NS32532); 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; } diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 6a53d52..f6a7c38 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -58,9 +58,9 @@ #define N_HEADER_IN_TEXT(x) 0 /* 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 \ && N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != ZMAGIC) @@ -111,11 +111,11 @@ struct pdp11_external_nlist #define EXTERNAL_NLIST_SIZE 8 #define N_TXTOFF(x) (EXEC_BYTES_SIZE) -#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) -#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) -#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) -#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize) -#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) +#define N_DATOFF(x) (N_TXTOFF(x) + (x)->a_text) +#define N_TRELOFF(x) (N_DATOFF(x) + (x)->a_data) +#define N_DRELOFF(x) (N_TRELOFF(x) + (x)->a_trsize) +#define N_SYMOFF(x) (N_DRELOFF(x) + (x)->a_drsize) +#define N_STROFF(x) (N_SYMOFF(x) + (x)->a_syms) #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 && 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; 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 || 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)) - || 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))) 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. */ if (execp->a_syms) abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; - if (N_DYNAMIC(*execp)) + if (N_DYNAMIC (execp)) abfd->flags |= DYNAMIC; - if (N_MAGIC (*execp) == ZMAGIC) + if (N_MAGIC (execp) == ZMAGIC) { abfd->flags |= D_PAGED | WP_TEXT; adata (abfd).magic = z_magic; } - else if (N_MAGIC (*execp) == NMAGIC) + else if (N_MAGIC (execp) == NMAGIC) { abfd->flags |= WP_TEXT; adata (abfd).magic = n_magic; } - else if (N_MAGIC (*execp) == OMAGIC) + else if (N_MAGIC (execp) == OMAGIC) adata (abfd).magic = o_magic; else { @@ -562,25 +562,25 @@ NAME (aout, some_aout_object_p) (bfd *abfd, in by the callback: */ 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. */ /* The virtual memory addresses of the sections. */ - obj_textsec (abfd)->vma = N_TXTADDR(*execp); - obj_datasec (abfd)->vma = N_DATADDR(*execp); - obj_bsssec (abfd)->vma = N_BSSADDR(*execp); + obj_textsec (abfd)->vma = N_TXTADDR (execp); + obj_datasec (abfd)->vma = N_DATADDR (execp); + obj_bsssec (abfd)->vma = N_BSSADDR (execp); /* The file offsets of the sections. */ - obj_textsec (abfd)->filepos = N_TXTOFF(*execp); - obj_datasec (abfd)->filepos = N_DATOFF(*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (execp); + obj_datasec (abfd)->filepos = N_DATOFF (execp); /* The file offsets of the relocation info. */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); + obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); /* The file offsets of the string table and symbol table. */ - obj_str_filepos (abfd) = N_STROFF (*execp); - obj_sym_filepos (abfd) = N_SYMOFF (*execp); + obj_str_filepos (abfd) = N_STROFF (execp); + obj_sym_filepos (abfd) = N_SYMOFF (execp); /* Determine the architecture and machine type of the object file. */ 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_data = obj_datasec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size; - N_SET_MAGIC (*execp, OMAGIC); + N_SET_MAGIC (execp, OMAGIC); } static void @@ -944,7 +944,7 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp) execp->a_text = obj_textsec(abfd)->size; if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) 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. */ 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_data = obj_datasec(abfd)->size; execp->a_bss = obj_bsssec(abfd)->size; - N_SET_MAGIC (*execp, NMAGIC); + N_SET_MAGIC (execp, NMAGIC); } bfd_boolean diff --git a/bfd/riscix.c b/bfd/riscix.c index 9388c48..a1f6401 100644 --- a/bfd/riscix.c +++ b/bfd/riscix.c @@ -63,11 +63,11 @@ /* Sl which uses another. */ #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. */ #define N_TXTOFF(x) \ - ((x).a_info == OMAGIC \ + ((x)->a_info == OMAGIC \ ? 32 \ : (N_MAGIC(x) == ZMAGIC \ ? TARGET_PAGE_SIZE \ @@ -81,13 +81,13 @@ 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. */ \ : (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)) #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 TARGET_PAGE_SIZE 32768 @@ -99,10 +99,10 @@ the tokens. */ #define MY(OP) CONCAT2 (arm_aout_riscix_,OP) #define TARGETNAME "a.out-riscix" -#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) \ - && (((x).a_info & ~006000) != OMAGIC) \ - && ((x).a_info != NMAGIC)) -#define N_MAGIC(x) ((x).a_info & ~07200) +#define N_BADMAG(x) ((((x)->a_info & ~007200) != ZMAGIC) \ + && (((x)->a_info & ~006000) != OMAGIC) \ + && ((x)->a_info != NMAGIC)) +#define N_MAGIC(x) ((x)->a_info & ~07200) #include "sysdep.h" #include "bfd.h" @@ -134,18 +134,18 @@ if (bfd_get_outsymbols (abfd) != NULL \ && 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; \ \ if (! NAME (aout, write_syms) (abfd)) \ 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; \ \ if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \ 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; \ \ 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. */ if (execp->a_syms) abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; - if (N_DYNAMIC(*execp)) + if (N_DYNAMIC (execp)) abfd->flags |= DYNAMIC; /* Squeezed files aren't supported (yet)! */ @@ -532,17 +532,17 @@ riscix_some_aout_object_p (bfd *abfd, bfd_set_error (bfd_error_wrong_format); return NULL; } - else if (N_MAGIC (*execp) == ZMAGIC) + else if (N_MAGIC (execp) == ZMAGIC) { abfd->flags |= D_PAGED | WP_TEXT; adata (abfd).magic = z_magic; } - else if (N_MAGIC (*execp) == NMAGIC) + else if (N_MAGIC (execp) == NMAGIC) { abfd->flags |= WP_TEXT; adata (abfd).magic = n_magic; } - else if (N_MAGIC (*execp) == OMAGIC) + else if (N_MAGIC (execp) == OMAGIC) adata (abfd).magic = o_magic; else /* 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); - if (N_BADMAG (exec)) + if (N_BADMAG (&exec)) return NULL; #ifdef MACHTYPE_OK - if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) + if (!(MACHTYPE_OK (N_MACHTYPE (&exec)))) return NULL; #endif diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 7632dbf..6af535d 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -66,11 +66,11 @@ sparclinux_write_object_contents (bfd *abfd) struct external_exec exec_bytes; 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; - WRITE_HEADERS(abfd, execp); + WRITE_HEADERS (abfd, execp); return TRUE; } diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c index 886731a..a90dc8b 100644 --- a/bfd/sparclynx.c +++ b/bfd/sparclynx.c @@ -120,8 +120,8 @@ NAME(lynx,set_arch_mach) (bfd *abfd, unsigned long machtype) bfd_set_arch_mach (abfd, arch, machine); } -#define SET_ARCH_MACH(ABFD, EXEC) \ - NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ +#define SET_ARCH_MACH(ABFD, EXECP) \ + NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \ choose_reloc_size(ABFD); /* 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)) { case bfd_mach_m68010: - N_SET_MACHTYPE (*execp, M_68010); + N_SET_MACHTYPE (execp, M_68010); break; default: case bfd_mach_m68020: - N_SET_MACHTYPE (*execp, M_68020); + N_SET_MACHTYPE (execp, M_68020); break; } break; case bfd_arch_sparc: - N_SET_MACHTYPE (*execp, M_SPARC); + N_SET_MACHTYPE (execp, M_SPARC); break; case bfd_arch_i386: - N_SET_MACHTYPE (*execp, M_386); + N_SET_MACHTYPE (execp, M_386); break; default: - N_SET_MACHTYPE (*execp, M_UNKNOWN); + N_SET_MACHTYPE (execp, M_UNKNOWN); } 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); |