From bbb1afc89b5cfa2f09b6a7c25fbfef745fbdd724 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 1 Dec 2015 11:40:52 +1030 Subject: [PATCH] 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. --- bfd/ChangeLog | 30 ++++++++++++++++++++++ bfd/aout-adobe.c | 18 +++++++------- bfd/aout-arm.c | 10 ++++---- bfd/aout-cris.c | 10 ++++---- bfd/aout-target.h | 32 ++++++++++++------------ bfd/aout-tic30.c | 32 ++++++++++++------------ bfd/aoutf1.h | 28 ++++++++++----------- bfd/aoutx.h | 42 +++++++++++++++---------------- bfd/bout.c | 20 +++++++-------- bfd/freebsd.h | 54 ++++++++++++++++++++-------------------- bfd/gen-aout.c | 2 +- bfd/hp300hpux.c | 38 ++++++++++++++-------------- bfd/i386aout.c | 4 +-- bfd/i386linux.c | 4 +-- bfd/i386lynx.c | 6 ++--- bfd/i386mach3.c | 2 +- bfd/i386os9k.c | 6 ++--- bfd/libaout.h | 40 ++++++++++++++--------------- bfd/m68klinux.c | 4 +-- bfd/m88kmach3.c | 2 +- bfd/mipsbsd.c | 20 +++++++-------- bfd/netbsd.h | 28 ++++++++++----------- bfd/pc532-mach.c | 12 ++++----- bfd/pdp11.c | 54 ++++++++++++++++++++-------------------- bfd/riscix.c | 36 +++++++++++++-------------- bfd/sparclinux.c | 4 +-- bfd/sparclynx.c | 16 ++++++------ gas/ChangeLog | 5 ++++ gas/config/aout_gnu.h | 42 +++++++++++++++---------------- include/ChangeLog | 6 +++++ include/aout/ChangeLog | 11 ++++++++ include/aout/adobe.h | 18 +++++++------- include/aout/aout64.h | 20 +++++++-------- include/aout/dynix3.h | 16 ++++++------ include/aout/encap.h | 4 +-- include/aout/hp.h | 8 +++--- include/aout/hp300hpux.h | 18 +++++++------- include/aout/sun4.h | 6 ++--- include/bout.h | 14 +++++------ include/os9k.h | 2 +- 40 files changed, 388 insertions(+), 336 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eb5cf11441..0fbdd64d6d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,33 @@ +2015-12-01 Alan Modra + + * 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 * coff-rs6000.c (_bfd_xcoff_put_symbol_name): Replace abfd param diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 7e781d4d74..3e64c1a4a0 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 9e5bb8fe8a..a1c13fea9d 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 166e305c1a..5280824e4a 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 0c97a4af58..a0e1494add 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 7fcdf6240b..6852c85556 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 7f4883545b..97e122b8e8 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 f78b9106a6..cca386af78 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 diff --git a/bfd/bout.c b/bfd/bout.c index d6f188bfa9..54c4db17fe 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -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 62d968202b..4a180b19a8 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_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(exec) \ +#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) + ((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(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) << 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 f7f0edd784..44c8479ec4 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 8bb58c96e5..564cdc2807 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 59e1ed25f8..3f40fb1241 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 2bec98b093..084dfb90d9 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 075d1c0e80..91cac43c2c 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 aa573f4544..582a13df7e 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 889c2adb22..a0b3384832 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 f1f6015d0f..9f32cc8d09 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 a29cf2be50..291a58fff7 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 783a9585bc..8c351c1b04 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 5ea89b6ee7..c969095e92 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 a53b5811d4..abd5fe7ba5 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 191ca21433..98c6644cad 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 6a53d52144..f6a7c3830e 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 9388c48aad..a1f6401426 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 7632dbfd29..6af535dbd3 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 886731a4e0..a90dc8b1ce 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); diff --git a/gas/ChangeLog b/gas/ChangeLog index b465923f44..3550646ed4 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2015-12-01 Alan Modra + + * config/aout_gnu.h: Invoke aout N_* macros with pointer to + struct internal_exec. + 2015-11-27 Matthew Wahab * config/tc-aarch64.c (aarch64_features): Add "fp16". diff --git a/gas/config/aout_gnu.h b/gas/config/aout_gnu.h index d9f816746a..c2a7ca493a 100644 --- a/gas/config/aout_gnu.h +++ b/gas/config/aout_gnu.h @@ -126,23 +126,23 @@ enum machine_type M_HPUX23 = 0x020C /* hp200/300 HPUX binary */ }; -#define N_MAGIC(exec) ((exec).a_info & 0xffff) -#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) -#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ +#define N_MAGIC(execp) ((execp)->a_info & 0xffff) +#define N_MACHTYPE(execp) ((enum machine_type)(((execp)->a_info >> 16) & 0xff)) +#define N_FLAGS(execp) (((execp)->a_info >> 24) & 0xff) +#define N_SET_INFO(execp, magic, type, flags) \ + ((execp)->a_info = ((magic) & 0xffff) \ | (((int)(type) & 0xff) << 16) \ | (((flags) & 0xff) << 24)) -#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))) -#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)) -#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)) /* Code indicating object file or impure executable. */ #ifndef OMAGIC @@ -185,23 +185,23 @@ enum machine_type #endif #ifndef N_DATOFF -#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) +#define N_DATOFF(x) ( N_TXTOFF(x) + (x)->a_text ) #endif #ifndef N_TRELOFF -#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) +#define N_TRELOFF(x) ( N_DATOFF(x) + (x)->a_data ) #endif #ifndef N_DRELOFF -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) +#define N_DRELOFF(x) ( N_TRELOFF(x) + (x)->a_trsize ) #endif #ifndef N_SYMOFF -#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) +#define N_SYMOFF(x) ( N_DRELOFF(x) + (x)->a_drsize ) #endif #ifndef N_STROFF -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) +#define N_STROFF(x) ( N_SYMOFF(x) + (x)->a_syms ) #endif /* Address of text segment in memory after it is loaded. */ @@ -211,12 +211,12 @@ enum machine_type #ifndef N_DATADDR #define N_DATADDR(x) \ - (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_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x)->a_text) \ + : (N_SEGSIZE(x) + ((N_TXTADDR(x)+(x)->a_text-1) & ~(N_SEGSIZE(x)-1)))) #endif /* 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 { diff --git a/include/ChangeLog b/include/ChangeLog index c8c0900e08..cd33a61802 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2015-12-01 Alan Modra + + * bout.h: Invoke aout N_* macros with pointer to + struct internal_exec. + * os9k.h: Likewise. + 2015-11-25 Rainer Orth * vtv-change-permission.h (VTV_PAGE_SIZE) [__sun__ && __svr4__ && diff --git a/include/aout/ChangeLog b/include/aout/ChangeLog index 790763b605..bf5dfdb21e 100644 --- a/include/aout/ChangeLog +++ b/include/aout/ChangeLog @@ -1,3 +1,14 @@ +2015-12-01 Alan Modra + + * 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 Update year range in copyright notice of all files. diff --git a/include/aout/adobe.h b/include/aout/adobe.h index 9c72fa5160..cf8cfce1dc 100644 --- a/include/aout/adobe.h +++ b/include/aout/adobe.h @@ -47,7 +47,7 @@ struct external_exec #undef OMAGIC #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 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 */ }; -#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. FIXME?! */ #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. */ #define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) ) -#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_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 ) /* Symbols */ struct external_nlist { diff --git a/include/aout/aout64.h b/include/aout/aout64.h index 7a250107de..08fd193e99 100644 --- a/include/aout/aout64.h +++ b/include/aout/aout64.h @@ -136,7 +136,7 @@ struct external_exec in the text. */ #ifndef N_HEADER_IN_TEXT #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 /* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC @@ -199,12 +199,12 @@ struct external_exec #define N_TXTSIZE(x) \ (/* For QMAGIC, we don't consider the header part of the text section. */\ N_IS_QMAGIC (x) \ - ? (x).a_text - EXEC_BYTES_SIZE \ + ? (x)->a_text - EXEC_BYTES_SIZE \ : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \ - ? (x).a_text \ + ? (x)->a_text \ : (N_HEADER_IN_TEXT (x) \ - ? (x).a_text - EXEC_BYTES_SIZE /* No padding. */ \ - : (x).a_text /* A page of padding. */ ))) + ? (x)->a_text - EXEC_BYTES_SIZE /* No padding. */ \ + : (x)->a_text /* A page of padding. */ ))) #endif /* The address of the data segment in virtual memory. It is the text segment address, plus text segment size, rounded @@ -218,7 +218,7 @@ struct external_exec #endif /* 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. */ @@ -238,16 +238,16 @@ struct external_exec #define N_DATOFF(x) (N_TXTOFF (x) + N_TXTSIZE (x)) #endif #ifndef N_TRELOFF -#define N_TRELOFF(x) (N_DATOFF (x) + (x).a_data) +#define N_TRELOFF(x) (N_DATOFF (x) + (x)->a_data) #endif #ifndef N_DRELOFF -#define N_DRELOFF(x) (N_TRELOFF (x) + (x).a_trsize) +#define N_DRELOFF(x) (N_TRELOFF (x) + (x)->a_trsize) #endif #ifndef N_SYMOFF -#define N_SYMOFF(x) (N_DRELOFF (x) + (x).a_drsize) +#define N_SYMOFF(x) (N_DRELOFF (x) + (x)->a_drsize) #endif #ifndef N_STROFF -#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms) +#define N_STROFF(x) (N_SYMOFF (x) + (x)->a_syms) #endif /* Symbols */ diff --git a/include/aout/dynix3.h b/include/aout/dynix3.h index 972477db9a..2703782598 100644 --- a/include/aout/dynix3.h +++ b/include/aout/dynix3.h @@ -69,19 +69,19 @@ struct dynix_external_exec #define N_TXTOFF(x) (EXEC_BYTES_SIZE) #define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x)) -#define N_SHDATOFF(x) (N_DATOFF(x) + (x).a_data) -#define N_TRELOFF(x) (N_SHDATOFF(x) + (x).a_shdata) -#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) -#define N_SHDRELOFF(x) (N_DRELOFF(x) + (x).a_drsize) -#define N_SYMOFF(x) (N_SHDRELOFF(x) + (x).a_shdrsize) -#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) +#define N_SHDATOFF(x) (N_DATOFF(x) + (x)->a_data) +#define N_TRELOFF(x) (N_SHDATOFF(x) + (x)->a_shdata) +#define N_DRELOFF(x) (N_TRELOFF(x) + (x)->a_trsize) +#define N_SHDRELOFF(x) (N_DRELOFF(x) + (x)->a_drsize) +#define N_SYMOFF(x) (N_SHDRELOFF(x) + (x)->a_shdrsize) +#define N_STROFF(x) (N_SYMOFF(x) + (x)->a_syms) #define N_TXTADDR(x) \ (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \ : TEXT_START_ADDR + EXEC_BYTES_SIZE) #define N_TXTSIZE(x) \ - (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x).a_text) \ - : ((x).a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE)) + (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x)->a_text) \ + : ((x)->a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE)) #endif /* A_OUT_DYNIX3_H */ diff --git a/include/aout/encap.h b/include/aout/encap.h index 6797e730f5..afed9b5c7f 100644 --- a/include/aout/encap.h +++ b/include/aout/encap.h @@ -131,5 +131,5 @@ short __header_offset_temp; #define N_DATADDR(x) \ ((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \ - (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1))) : \ - (N_TXTADDR(x)+(x).a_text)) + (SEGMENT_SIZE + ((N_TXTADDR(x)+(x)->a_text-1) & ~(SEGMENT_SIZE-1))) : \ + (N_TXTADDR(x)+(x)->a_text)) diff --git a/include/aout/hp.h b/include/aout/hp.h index be27668bd0..91b77bdef1 100644 --- a/include/aout/hp.h +++ b/include/aout/hp.h @@ -60,10 +60,10 @@ struct exec #undef N_SET_MACHTYPE #undef N_SET_FLAGS -#define N_MAGIC(exec) ((exec) . a_magic) -#define N_MACHTYPE(exec) ((exec) . a_machtype) -#define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic)) -#define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype)) +#define N_MAGIC(execp) ((execp)->a_magic) +#define N_MACHTYPE(execp) ((execp)->a_machtype) +#define N_SET_MAGIC(execp, magic) (((execp)->a_magic) = (magic)) +#define N_SET_MACHTYPE(execp, machtype) (((execp)->a_machtype) = (machtype)) #undef N_BADMAG #define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) diff --git a/include/aout/hp300hpux.h b/include/aout/hp300hpux.h index 527e421725..cc65927693 100644 --- a/include/aout/hp300hpux.h +++ b/include/aout/hp300hpux.h @@ -113,18 +113,18 @@ struct hp300hpux_header_extension #undef N_STROFF #define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) ) -#define N_PASOFF(x) ( N_DATOFF(x) + (x).a_data) -#define N_SYMOFF(x) ( N_PASOFF(x) /* + (x).a_passize*/ ) -#define N_SUPOFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#define N_TRELOFF(x) ( N_SUPOFF(x) /* + 0 (x).a_supsize*/ ) -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) -#define N_EXTHOFF(x) ( N_DRELOFF(x) /* + 0 (x).a_drsize */) +#define N_PASOFF(x) ( N_DATOFF(x) + (x)->a_data) +#define N_SYMOFF(x) ( N_PASOFF(x) /* + (x)->a_passize*/ ) +#define N_SUPOFF(x) ( N_SYMOFF(x) + (x)->a_syms ) +#define N_TRELOFF(x) ( N_SUPOFF(x) /* + (x)->a_supsize*/ ) +#define N_DRELOFF(x) ( N_TRELOFF(x) + (x)->a_trsize ) +#define N_EXTHOFF(x) ( N_DRELOFF(x) /* + (x)->a_drsize */) #define N_STROFF(x) ( 0 /* no string table */ ) /* use these when the file has gnu symbol tables */ -#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_SYMOFF(x) (N_GNU_DRELOFF(x) + (x).a_drsize) +#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_SYMOFF(x) (N_GNU_DRELOFF(x) + (x)->a_drsize) #define TARGET_PAGE_SIZE 0x1000 #define SEGMENT_SIZE 0x1000 diff --git a/include/aout/sun4.h b/include/aout/sun4.h index c6e3d2ce18..9be0a11aeb 100644 --- a/include/aout/sun4.h +++ b/include/aout/sun4.h @@ -44,8 +44,8 @@ expected text address. These kludges have gotta go! For linked files, should reflect reality if we know it. */ -#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR \ - && (x).a_text >= EXEC_BYTES_SIZE) +#define N_SHARED_LIB(x) ((x)->a_entry < TEXT_START_ADDR \ + && (x)->a_text >= EXEC_BYTES_SIZE) /* 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; @@ -53,7 +53,7 @@ #define N_TXTADDR(x) \ (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) /* When a file is linked against a shared library on SunOS 4, the diff --git a/include/bout.h b/include/bout.h index b28cdaa522..dbbfc5e6d1 100644 --- a/include/bout.h +++ b/include/bout.h @@ -87,16 +87,16 @@ struct external_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. */ -#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_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) -#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) +#define N_DATOFF(x) ( N_TXTOFF(x) + (x)->a_text ) +#define N_TROFF(x) ( N_DATOFF(x) + (x)->a_data ) #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_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize ) -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#define N_DATADDR(x) ( (x).a_dload ) +#define N_SYMOFF(x) ( N_DROFF(x) + (x)->a_drsize ) +#define N_STROFF(x) ( N_SYMOFF(x) + (x)->a_syms ) +#define N_DATADDR(x) ( (x)->a_dload ) /* Address of text segment in memory after it is loaded. */ #if !defined (N_TXTADDR) diff --git a/include/os9k.h b/include/os9k.h index 4329013d27..accd9d0701 100644 --- a/include/os9k.h +++ b/include/os9k.h @@ -100,7 +100,7 @@ Boston, MA 02110-1301, USA. */ #define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size) #endif /* 0 */ #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 {