diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-25 21:15:46 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-27 21:58:46 +1030 |
commit | a2c7ca15a5609ea230771fc418511a3b8db16bd1 (patch) | |
tree | 3e5b9c33b8f90ce7b8afd8621ca7cdf5ea35caff /bfd | |
parent | 3bb1480e2a85de6850863d245e7b6da03a3887f7 (diff) | |
download | gdb-a2c7ca15a5609ea230771fc418511a3b8db16bd1.zip gdb-a2c7ca15a5609ea230771fc418511a3b8db16bd1.tar.gz gdb-a2c7ca15a5609ea230771fc418511a3b8db16bd1.tar.bz2 |
Use stdint types in coff internal_auxent
long is a poor choice of type to store 32-bit values read from
objects files by H_GET_32. H_GET_32 doesn't sign extend so tests like
that in gdb/coffread.c for "negative" values won't work if long is
larger than 32 bits. If long is 32-bit then code needs to be careful
to not accidentally index negative array elements. (I'd rather see a
segfault on an unmapped 4G array index than silently reading bogus
data.) long is also a poor choice for x_sect.s_scnlen, which might
have 64-bit values. It's better to use unsigned exact width types to
avoid surprises.
I decided to change the field names too, which makes most of this
patch simply renaming. Besides that there are a few places where
casts are no longer needed, and where printf format strings or tests
need adjusting.
include/
* coff/internal.h (union internal_auxent): Use unsigned stdint
types. Rename l fields to u32 and u64 as appropriate.
bfd/
* coff-bfd.c,
* coff-rs6000.c,
* coff64-rs6000.c,
* coffcode.h,
* coffgen.c,
* cofflink.c,
* coffswap.h,
* peXXigen.c,
* xcofflink.c: Adjust to suit internal_auxent changes.
binutils/
* rdcoff.c: Adjust to suit internal_auxent changes.
gas/
* config/obj-coff.h,
* config/tc-ppc.c: Adjust to suit internal_auxent changes.
gdb/
* coffread.c,
* xcoffread.c: Adjust to suit internal_auxent changes.
ld/
* pe-dll.c: Adjust to suit internal_auxent changes.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/coff-bfd.c | 6 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 10 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 14 | ||||
-rw-r--r-- | bfd/coffcode.h | 18 | ||||
-rw-r--r-- | bfd/coffgen.c | 39 | ||||
-rw-r--r-- | bfd/cofflink.c | 22 | ||||
-rw-r--r-- | bfd/coffswap.h | 8 | ||||
-rw-r--r-- | bfd/peXXigen.c | 8 | ||||
-rw-r--r-- | bfd/xcofflink.c | 63 |
9 files changed, 93 insertions, 95 deletions
diff --git a/bfd/coff-bfd.c b/bfd/coff-bfd.c index 9660b6b..292778e 100644 --- a/bfd/coff-bfd.c +++ b/bfd/coff-bfd.c @@ -83,7 +83,7 @@ bfd_coff_get_auxent (bfd *abfd, if (ent->fix_tag) { - pauxent->x_sym.x_tagndx.l = + pauxent->x_sym.x_tagndx.u32 = ((combined_entry_type *) pauxent->x_sym.x_tagndx.p - obj_raw_syments (abfd)); ent->fix_tag = 0; @@ -91,7 +91,7 @@ bfd_coff_get_auxent (bfd *abfd, if (ent->fix_end) { - pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l = + pauxent->x_sym.x_fcnary.x_fcn.x_endndx.u32 = ((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p - obj_raw_syments (abfd)); ent->fix_end = 0; @@ -99,7 +99,7 @@ bfd_coff_get_auxent (bfd *abfd, if (ent->fix_scnlen) { - pauxent->x_csect.x_scnlen.l = + pauxent->x_csect.x_scnlen.u64 = ((combined_entry_type *) pauxent->x_csect.x_scnlen.p - obj_raw_syments (abfd)); ent->fix_scnlen = 0; diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index ea8c828..6c4e32c 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -507,7 +507,7 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type ATTRIBUTE_UNUSED, case C_HIDEXT: if (indx + 1 == numaux) { - in->x_csect.x_scnlen.l = H_GET_32 (abfd, ext->x_csect.x_scnlen); + in->x_csect.x_scnlen.u64 = H_GET_32 (abfd, ext->x_csect.x_scnlen); in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash); in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash); /* We don't have to hack bitfields in x_smtyp because it's @@ -525,7 +525,7 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type ATTRIBUTE_UNUSED, = H_GET_32 (abfd, ext->x_fcn.x_fsize); in->x_sym.x_fcnary.x_fcn.x_lnnoptr = H_GET_32 (abfd, ext->x_fcn.x_lnnoptr); - in->x_sym.x_fcnary.x_fcn.x_endndx.l + in->x_sym.x_fcnary.x_fcn.x_endndx.u32 = H_GET_32 (abfd, ext->x_fcn.x_endndx); } break; @@ -591,7 +591,7 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type ATTRIBUTE_UNUSED, case C_HIDEXT: if (indx + 1 == numaux) { - H_PUT_32 (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen); + H_PUT_32 (abfd, in->x_csect.x_scnlen.u64, ext->x_csect.x_scnlen); H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); /* We don't have to hack bitfields in x_smtyp because it's @@ -607,7 +607,7 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type ATTRIBUTE_UNUSED, H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_fcn.x_fsize); H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext->x_fcn.x_lnnoptr); - H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, + H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.u32, ext->x_fcn.x_endndx); } break; @@ -4146,7 +4146,7 @@ xcoff_generate_rtinit (bfd *abfd, const char *init, const char *fini, syment.n_scnum = 1; syment.n_sclass = C_HIDEXT; syment.n_numaux = 1; - auxent.x_csect.x_scnlen.l = data_buffer_size; + auxent.x_csect.x_scnlen.u64 = data_buffer_size; auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD; auxent.x_csect.x_smclas = XMC_RW; bfd_coff_swap_sym_out (abfd, &syment, diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index e3a5da3..f8a0bde 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -411,10 +411,10 @@ _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type ATTRIBUTE_UNUSED, if (auxtype != _AUX_CSECT) goto error; - bfd_vma h = H_GET_S32 (abfd, ext->x_csect.x_scnlen_hi); + bfd_vma h = H_GET_32 (abfd, ext->x_csect.x_scnlen_hi); bfd_vma l = H_GET_32 (abfd, ext->x_csect.x_scnlen_lo); - in->x_csect.x_scnlen.l = h << 32 | (l & 0xffffffff); + in->x_csect.x_scnlen.u64 = h << 32 | (l & 0xffffffff); in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash); in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash); @@ -436,7 +436,7 @@ _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type ATTRIBUTE_UNUSED, = H_GET_64 (abfd, ext->x_fcn.x_lnnoptr); in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_fcn.x_fsize); - in->x_sym.x_fcnary.x_fcn.x_endndx.l + in->x_sym.x_fcnary.x_fcn.x_endndx.u32 = H_GET_32 (abfd, ext->x_fcn.x_endndx); } break; @@ -524,9 +524,9 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type ATTRIBUTE_UNUSED, { bfd_vma temp; - temp = in->x_csect.x_scnlen.l & 0xffffffff; + temp = in->x_csect.x_scnlen.u64 & 0xffffffff; H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_lo); - temp = in->x_csect.x_scnlen.l >> 32; + temp = in->x_csect.x_scnlen.u64 >> 32; H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_hi); H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); @@ -542,7 +542,7 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type ATTRIBUTE_UNUSED, H_PUT_64 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext->x_fcn.x_lnnoptr); H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_fcn.x_fsize); - H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, + H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.u32, ext->x_fcn.x_endndx); H_PUT_8 (abfd, _AUX_FCN, ext->x_csect.x_auxtype); } @@ -2265,7 +2265,7 @@ xcoff64_generate_rtinit (bfd *abfd, const char *init, const char *fini, syment.n_scnum = 2; syment.n_sclass = C_HIDEXT; syment.n_numaux = 1; - auxent.x_csect.x_scnlen.l = data_buffer_size; + auxent.x_csect.x_scnlen.u64 = data_buffer_size; auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD; auxent.x_csect.x_smclas = XMC_RW; bfd_coff_swap_sym_out (abfd, &syment, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index d4a2a5c..5d6be49 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2463,10 +2463,10 @@ coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED, { BFD_ASSERT (! aux->is_sym); if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD - && (bfd_vma) aux->u.auxent.x_csect.x_scnlen.l < obj_raw_syment_count (abfd)) + && aux->u.auxent.x_csect.x_scnlen.u64 < obj_raw_syment_count (abfd)) { aux->u.auxent.x_csect.x_scnlen.p = - table_base + aux->u.auxent.x_csect.x_scnlen.l; + table_base + aux->u.auxent.x_csect.x_scnlen.u64; aux->fix_scnlen = 1; } @@ -2505,21 +2505,21 @@ coff_print_aux (bfd *abfd ATTRIBUTE_UNUSED, if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD) { BFD_ASSERT (! aux->fix_scnlen); - fprintf (file, "val %5" PRId64, - (int64_t) aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "val %5" PRIu64, + aux->u.auxent.x_csect.x_scnlen.u64); } else { fprintf (file, "indx "); if (! aux->fix_scnlen) - fprintf (file, "%4" PRId64, - (int64_t) aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "%4" PRIu64, + aux->u.auxent.x_csect.x_scnlen.u64); else fprintf (file, "%4ld", (long) (aux->u.auxent.x_csect.x_scnlen.p - table_base)); } fprintf (file, - " prmhsh %ld snhsh %u typ %d algn %d clss %u stb %ld snstb %u", + " prmhsh %u snhsh %u typ %d algn %d clss %u stb %u snstb %u", aux->u.auxent.x_csect.x_parmhash, (unsigned int) aux->u.auxent.x_csect.x_snhash, SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp), @@ -5745,7 +5745,7 @@ coff_bigobj_swap_aux_in (bfd *abfd, break; default: - in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->Sym.WeakDefaultSymIndex); + in->x_sym.x_tagndx.u32 = H_GET_32 (abfd, ext->Sym.WeakDefaultSymIndex); /* Characteristics is ignored. */ break; } @@ -5793,7 +5793,7 @@ coff_bigobj_swap_aux_out (bfd * abfd, break; } - H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->Sym.WeakDefaultSymIndex); + H_PUT_32 (abfd, in->x_sym.x_tagndx.u32, ext->Sym.WeakDefaultSymIndex); H_PUT_32 (abfd, 1, ext->Sym.WeakSearchType); return AUXESZ; diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 0b764b0..3eec2d5 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -802,19 +802,19 @@ coff_mangle_symbols (bfd *bfd_ptr) BFD_ASSERT (! a->is_sym); if (a->fix_tag) { - a->u.auxent.x_sym.x_tagndx.l = + a->u.auxent.x_sym.x_tagndx.u32 = a->u.auxent.x_sym.x_tagndx.p->offset; a->fix_tag = 0; } if (a->fix_end) { - a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l = + a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.u32 = a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p->offset; a->fix_end = 0; } if (a->fix_scnlen) { - a->u.auxent.x_csect.x_scnlen.l = + a->u.auxent.x_csect.x_scnlen.u64 = a->u.auxent.x_csect.x_scnlen.p->offset; a->fix_scnlen = 0; } @@ -1463,25 +1463,24 @@ coff_pointerize_aux (bfd *abfd, if ((ISFCN (type) || ISTAG (n_sclass) || n_sclass == C_BLOCK || n_sclass == C_FCN) - && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0 - && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l - < (long) obj_raw_syment_count (abfd) - && table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l - < table_end) + && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.u32 > 0 + && (auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.u32 + < obj_raw_syment_count (abfd)) + && (table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.u32 + < table_end)) { auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p = - table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l; + table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.u32; auxent->fix_end = 1; } /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can generate one, so we must be careful to ignore it. */ - if ((unsigned long) auxent->u.auxent.x_sym.x_tagndx.l - < obj_raw_syment_count (abfd) - && table_base + auxent->u.auxent.x_sym.x_tagndx.l < table_end) + if (auxent->u.auxent.x_sym.x_tagndx.u32 < obj_raw_syment_count (abfd) + && table_base + auxent->u.auxent.x_sym.x_tagndx.u32 < table_end) { auxent->u.auxent.x_sym.x_tagndx.p = - table_base + auxent->u.auxent.x_sym.x_tagndx.l; + table_base + auxent->u.auxent.x_sym.x_tagndx.u32; auxent->fix_tag = 1; } } @@ -2092,7 +2091,7 @@ coff_print_symbol (bfd *abfd, if (auxp->fix_tag) tagndx = auxp->u.auxent.x_sym.x_tagndx.p - root; else - tagndx = auxp->u.auxent.x_sym.x_tagndx.l; + tagndx = auxp->u.auxent.x_sym.x_tagndx.u32; fprintf (file, "\n"); @@ -2112,8 +2111,8 @@ coff_print_symbol (bfd *abfd, break; case C_DWARF: - fprintf (file, "AUX scnlen 0x%lx nreloc %ld", - (unsigned long) auxp->u.auxent.x_sect.x_scnlen, + fprintf (file, "AUX scnlen %#" PRIx64 " nreloc %" PRId64, + auxp->u.auxent.x_sect.x_scnlen, auxp->u.auxent.x_sect.x_nreloc); break; @@ -2128,7 +2127,7 @@ coff_print_symbol (bfd *abfd, if (auxp->u.auxent.x_scn.x_checksum != 0 || auxp->u.auxent.x_scn.x_associated != 0 || auxp->u.auxent.x_scn.x_comdat != 0) - fprintf (file, " checksum 0x%lx assoc %d comdat %d", + fprintf (file, " checksum 0x%x assoc %d comdat %d", auxp->u.auxent.x_scn.x_checksum, auxp->u.auxent.x_scn.x_associated, auxp->u.auxent.x_scn.x_comdat); @@ -2145,7 +2144,7 @@ coff_print_symbol (bfd *abfd, next = (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p - root); else - next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l; + next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.u32; llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr; fprintf (file, "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld", @@ -2797,8 +2796,8 @@ _bfd_coff_gc_mark_hook (asection *sec, record indicating that if the weak symbol is not resolved, another external symbol is used instead. */ struct coff_link_hash_entry *h2 = - h->auxbfd->tdata.coff_obj_data->sym_hashes[ - h->aux->x_sym.x_tagndx.l]; + h->auxbfd->tdata.coff_obj_data->sym_hashes + [h->aux->x_sym.x_tagndx.u32]; if (h2 && h2->root.type != bfd_link_hash_undefined) return h2->root.u.def.section; diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 0de2e0b..9baec2f 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -1617,7 +1617,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) islp = isymp + 2; esl = esym + 2 * isymesz; eslend = ((bfd_byte *) obj_coff_external_syms (input_bfd) - + aux.x_sym.x_fcnary.x_fcn.x_endndx.l * isymesz); + + aux.x_sym.x_fcnary.x_fcn.x_endndx.u32 * isymesz); while (esl < eslend) { const char *elename; @@ -1656,7 +1656,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) bfd_coff_swap_aux_in (input_bfd, (esl + isymesz), islp->n_type, islp->n_sclass, 0, islp->n_numaux, &eleaux); - indx = eleaux.x_sym.x_tagndx.l; + indx = eleaux.x_sym.x_tagndx.u32; /* FIXME: If this tagndx entry refers to a symbol defined later in this file, we just ignore it. @@ -1997,7 +1997,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) || isymp->n_sclass == C_BLOCK || isymp->n_sclass == C_FCN) { - indx = auxp->x_sym.x_fcnary.x_fcn.x_endndx.l; + indx = auxp->x_sym.x_fcnary.x_fcn.x_endndx.u32; if (indx > 0 && indx < obj_raw_syment_count (input_bfd)) { @@ -2014,20 +2014,20 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) indx = output_index; else indx = flaginfo->sym_indices[indx]; - auxp->x_sym.x_fcnary.x_fcn.x_endndx.l = indx; + auxp->x_sym.x_fcnary.x_fcn.x_endndx.u32 = indx; } } - indx = auxp->x_sym.x_tagndx.l; + indx = auxp->x_sym.x_tagndx.u32; if (indx > 0 && indx < obj_raw_syment_count (input_bfd)) { long symindx; symindx = flaginfo->sym_indices[indx]; if (symindx < 0) - auxp->x_sym.x_tagndx.l = 0; + auxp->x_sym.x_tagndx.u32 = 0; else - auxp->x_sym.x_tagndx.l = symindx; + auxp->x_sym.x_tagndx.u32 = symindx; } /* The .bf symbols are supposed to be linked through @@ -2045,7 +2045,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) { if (flaginfo->last_bf_index != -1) { - flaginfo->last_bf.x_sym.x_fcnary.x_fcn.x_endndx.l = + flaginfo->last_bf.x_sym.x_fcnary.x_fcn.x_endndx.u32 = *indexp; if ((bfd_size_type) flaginfo->last_bf_index @@ -2093,7 +2093,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) } } - if (auxp->x_sym.x_fcnary.x_fcn.x_endndx.l != 0) + if (auxp->x_sym.x_fcnary.x_fcn.x_endndx.u32 != 0) flaginfo->last_bf_index = -1; else { @@ -3002,8 +3002,8 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, external causes the library member to be linked. See also linker.c: generic_link_check_archive_element. */ struct coff_link_hash_entry *h2 = - h->auxbfd->tdata.coff_obj_data->sym_hashes[ - h->aux->x_sym.x_tagndx.l]; + h->auxbfd->tdata.coff_obj_data->sym_hashes + [h->aux->x_sym.x_tagndx.u32]; if (!h2 || h2->root.type == bfd_link_hash_undefined) { diff --git a/bfd/coffswap.h b/bfd/coffswap.h index 03f52bd..190b8f0 100644 --- a/bfd/coffswap.h +++ b/bfd/coffswap.h @@ -460,7 +460,7 @@ coff_swap_aux_in (bfd *abfd, break; } - in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx); + in->x_sym.x_tagndx.u32 = H_GET_32 (abfd, ext->x_sym.x_tagndx); #ifndef NO_TVNDX in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx); #endif @@ -469,7 +469,7 @@ coff_swap_aux_in (bfd *abfd, || ISTAG (in_class)) { in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext); - in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext); + in->x_sym.x_fcnary.x_fcn.x_endndx.u32 = GET_FCN_ENDNDX (abfd, ext); } else { @@ -552,7 +552,7 @@ coff_swap_aux_out (bfd * abfd, break; } - H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx); + H_PUT_32 (abfd, in->x_sym.x_tagndx.u32, ext->x_sym.x_tagndx); #ifndef NO_TVNDX H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx); #endif @@ -561,7 +561,7 @@ coff_swap_aux_out (bfd * abfd, || ISTAG (in_class)) { PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); - PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); + PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.u32, ext); } else { diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 42f2d21..d240e01 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -316,14 +316,14 @@ _bfd_XXi_swap_aux_in (bfd * abfd, break; } - in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx); + in->x_sym.x_tagndx.u32 = H_GET_32 (abfd, ext->x_sym.x_tagndx); in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx); if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type) || ISTAG (in_class)) { in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext); - in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext); + in->x_sym.x_fcnary.x_fcn.x_endndx.u32 = GET_FCN_ENDNDX (abfd, ext); } else { @@ -391,14 +391,14 @@ _bfd_XXi_swap_aux_out (bfd * abfd, break; } - H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx); + H_PUT_32 (abfd, in->x_sym.x_tagndx.u32, ext->x_sym.x_tagndx); H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx); if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type) || ISTAG (in_class)) { PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); - PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); + PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.u32, ext); } else { diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index a67f24b..b57ed21 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1577,14 +1577,14 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) /* This is an external reference. */ if (sym.n_sclass == C_HIDEXT || sym.n_scnum != N_UNDEF - || aux.x_csect.x_scnlen.l != 0) + || aux.x_csect.x_scnlen.u64 != 0) { _bfd_error_handler /* xgettext:c-format */ (_("%pB: bad XTY_ER symbol `%s': class %d scnum %d " "scnlen %" PRId64), abfd, name, sym.n_sclass, sym.n_scnum, - (int64_t) aux.x_csect.x_scnlen.l); + aux.x_csect.x_scnlen.u64); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1608,12 +1608,12 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) if (aux.x_csect.x_smclas == XMC_TC0) { if (sym.n_sclass != C_HIDEXT - || aux.x_csect.x_scnlen.l != 0) + || aux.x_csect.x_scnlen.u64 != 0) { _bfd_error_handler /* xgettext:c-format */ - (_("%pB: XMC_TC0 symbol `%s' is class %d scnlen %" PRId64), - abfd, name, sym.n_sclass, (int64_t) aux.x_csect.x_scnlen.l); + (_("%pB: XMC_TC0 symbol `%s' is class %d scnlen %" PRIu64), + abfd, name, sym.n_sclass, aux.x_csect.x_scnlen.u64); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1643,9 +1643,9 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) && sym.n_sclass == C_HIDEXT && info->output_bfd->xvec == abfd->xvec && ((bfd_xcoff_is_xcoff32 (abfd) - && aux.x_csect.x_scnlen.l == 4) + && aux.x_csect.x_scnlen.u64 == 4) || (bfd_xcoff_is_xcoff64 (abfd) - && aux.x_csect.x_scnlen.l == 8))) + && aux.x_csect.x_scnlen.u64 == 8))) { asection *enclosing; struct internal_reloc *relocs; @@ -1776,7 +1776,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) if (! bfd_is_abs_section (enclosing) && ((bfd_vma) sym.n_value < enclosing->vma - || ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l + || (sym.n_value + aux.x_csect.x_scnlen.u64 > enclosing->vma + enclosing->size))) { _bfd_error_handler @@ -1790,8 +1790,8 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) csect->filepos = (enclosing->filepos + sym.n_value - enclosing->vma); - csect->size = aux.x_csect.x_scnlen.l; - csect->rawsize = aux.x_csect.x_scnlen.l; + csect->size = aux.x_csect.x_scnlen.u64; + csect->rawsize = aux.x_csect.x_scnlen.u64; csect->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); @@ -1876,13 +1876,12 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) bool bad; bad = false; - if (aux.x_csect.x_scnlen.l < 0 - || (aux.x_csect.x_scnlen.l - >= esym - (bfd_byte *) obj_coff_external_syms (abfd))) + if (aux.x_csect.x_scnlen.u64 + >= (size_t) (esym - (bfd_byte *) obj_coff_external_syms (abfd))) bad = true; if (! bad) { - section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.l]; + section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.u64]; if (section == NULL || (section->flags & SEC_HAS_CONTENTS) == 0) bad = true; @@ -1929,7 +1928,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) if (csect == NULL) goto error_return; csect->vma = sym.n_value; - csect->size = aux.x_csect.x_scnlen.l; + csect->size = aux.x_csect.x_scnlen.u64; csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); /* There are a number of other fields and section flags which we do not bother to set. */ @@ -1956,7 +1955,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) csect->flags |= SEC_IS_COMMON; csect->size = 0; section = csect; - value = aux.x_csect.x_scnlen.l; + value = aux.x_csect.x_scnlen.u64; } break; @@ -5556,7 +5555,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, { unsigned long indx; - indx = aux.x_csect.x_scnlen.l; + indx = aux.x_csect.x_scnlen.u64; if (indx < obj_raw_syment_count (input_bfd)) { long symindx; @@ -5564,11 +5563,11 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, symindx = flinfo->sym_indices[indx]; if (symindx < 0) { - aux.x_csect.x_scnlen.l = 0; + aux.x_csect.x_scnlen.u64 = 0; } else { - aux.x_csect.x_scnlen.l = symindx; + aux.x_csect.x_scnlen.u64 = symindx; } } } @@ -5582,7 +5581,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, || isymp->n_sclass == C_BLOCK || isymp->n_sclass == C_FCN) { - indx = aux.x_sym.x_fcnary.x_fcn.x_endndx.l; + indx = aux.x_sym.x_fcnary.x_fcn.x_endndx.u32; if (indx > 0 && indx < obj_raw_syment_count (input_bfd)) { @@ -5597,21 +5596,21 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, indx = output_index; else indx = flinfo->sym_indices[indx]; - aux.x_sym.x_fcnary.x_fcn.x_endndx.l = indx; + aux.x_sym.x_fcnary.x_fcn.x_endndx.u32 = indx; } } - indx = aux.x_sym.x_tagndx.l; + indx = aux.x_sym.x_tagndx.u32; if (indx > 0 && indx < obj_raw_syment_count (input_bfd)) { long symindx; symindx = flinfo->sym_indices[indx]; if (symindx < 0) - aux.x_sym.x_tagndx.l = 0; + aux.x_sym.x_tagndx.u32 = 0; else - aux.x_sym.x_tagndx.l = symindx; + aux.x_sym.x_tagndx.u32 = symindx; } } @@ -6208,7 +6207,7 @@ xcoff_find_tc0 (bfd *output_bfd, struct xcoff_final_link_info *flinfo) memset (&iraux, 0, sizeof iraux); iraux.x_csect.x_smtyp = XTY_SD; iraux.x_csect.x_smclas = XMC_TC0; - iraux.x_csect.x_scnlen.l = 0; + iraux.x_csect.x_scnlen.u64 = 0; bfd_coff_swap_aux_out (output_bfd, &iraux, T_NULL, C_HIDEXT, 0, 1, flinfo->outsyms + bfd_coff_symesz (output_bfd)); @@ -6424,7 +6423,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) whether the output is 32 or 64 bit. */ memset (&iraux, 0, sizeof iraux); iraux.x_csect.x_smtyp = XTY_SD; - /* iraux.x_csect.x_scnlen.l = 4 or 8, see below. */ + /* iraux.x_csect.x_scnlen.u64 = 4 or 8, see below. */ iraux.x_csect.x_smclas = XMC_TC; /* 32 bit uses a 32 bit R_POS to do the relocations @@ -6436,12 +6435,12 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) if (bfd_xcoff_is_xcoff64 (output_bfd)) { irel->r_size = 63; - iraux.x_csect.x_scnlen.l = 8; + iraux.x_csect.x_scnlen.u64 = 8; } else if (bfd_xcoff_is_xcoff32 (output_bfd)) { irel->r_size = 31; - iraux.x_csect.x_scnlen.l = 4; + iraux.x_csect.x_scnlen.u64 = 4; } else return false; @@ -6716,7 +6715,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) /* For stub symbols, the section already has its correct size. */ if (h->root.u.def.section->owner == xcoff_hash_table (flinfo->info)->params->stub_bfd) { - aux.x_csect.x_scnlen.l = h->root.u.def.section->size; + aux.x_csect.x_scnlen.u64 = h->root.u.def.section->size; } else if ((h->flags & XCOFF_HAS_SIZE) != 0) { @@ -6726,7 +6725,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) { if (l->h == h) { - aux.x_csect.x_scnlen.l = l->size; + aux.x_csect.x_scnlen.u64 = l->size; break; } } @@ -6739,7 +6738,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) isym.n_scnum = h->root.u.c.p->section->output_section->target_index; isym.n_sclass = C_EXT; aux.x_csect.x_smtyp = XTY_CM; - aux.x_csect.x_scnlen.l = h->root.u.c.size; + aux.x_csect.x_scnlen.u64 = h->root.u.c.size; } else abort (); @@ -6771,7 +6770,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) outsym += bfd_coff_symesz (output_bfd); aux.x_csect.x_smtyp = XTY_LD; - aux.x_csect.x_scnlen.l = obj_raw_syment_count (output_bfd); + aux.x_csect.x_scnlen.u64 = obj_raw_syment_count (output_bfd); bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, C_EXT, 0, 1, (void *) outsym); outsym += bfd_coff_auxesz (output_bfd); |