From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 764F5385483E; Mon, 27 Mar 2023 11:33:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 764F5385483E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Tidy tc-ppc.c XCOFF auxent access X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: f00a29e30bfbe33e1be8d174e01763e745190a4a X-Git-Newrev: 943527750e9ca12837c6f63cd28f50f41bd682be Message-Id: <20230327113355.764F5385483E@sourceware.org> Date: Mon, 27 Mar 2023 11:33:55 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2023 11:33:55 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D943527750e9c= a12837c6f63cd28f50f41bd682be commit 943527750e9ca12837c6f63cd28f50f41bd682be Author: Alan Modra Date: Mon Mar 27 17:02:15 2023 +1030 Tidy tc-ppc.c XCOFF auxent access =20 It's better not to drill down into u.auxent but instead use a pointer to the combined_entry_type. That way the fix_scnlen field is available, and no one looking at the codes needs to wonder whether coffsymbol (symbol_get_bfdsym (sym))->native[i + 1] is the same auxent. =20 * config/tc-ppc.c (ppc_frob_symbol): Tidy XCOFF auxent access. (ppc_adjust_symtab): Likewise. Diff: --- gas/config/tc-ppc.c | 93 +++++++++++++++++++++++++++----------------------= ---- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index d25c751378d..ae14fae44bd 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -6154,11 +6154,11 @@ ppc_frob_symbol (symbolS *sym) { /* Size of containing csect. */ symbolS* within =3D symbol_get_tc (sym)->within; - union internal_auxent *csectaux; - csectaux =3D &coffsymbol (symbol_get_bfdsym (within)) - ->native[S_GET_NUMBER_AUXILIARY(within)].u.auxent; + coff_symbol_type *csect =3D coffsymbol (symbol_get_bfdsym (within)); + combined_entry_type *csectaux + =3D &csect->native[S_GET_NUMBER_AUXILIARY(within)]; =20 - SA_SET_SYM_FSIZE (sym, csectaux->x_csect.x_scnlen.u64); + SA_SET_SYM_FSIZE (sym, csectaux->u.auxent.x_csect.x_scnlen.u64); } } else if (S_GET_STORAGE_CLASS (sym) =3D=3D C_FCN @@ -6194,44 +6194,47 @@ ppc_frob_symbol (symbolS *sym) || S_GET_STORAGE_CLASS (sym) =3D=3D C_HIDEXT) { int i; - union internal_auxent *a; + combined_entry_type *a; =20 /* Create a csect aux. */ i =3D S_GET_NUMBER_AUXILIARY (sym); S_SET_NUMBER_AUXILIARY (sym, i + 1); - a =3D &coffsymbol (symbol_get_bfdsym (sym))->native[i + 1].u.auxent; + a =3D &coffsymbol (symbol_get_bfdsym (sym))->native[i + 1]; if (symbol_get_tc (sym)->symbol_class =3D=3D XMC_TC0) { /* This is the TOC table. */ know (strcmp (S_GET_NAME (sym), "TOC") =3D=3D 0); - a->x_csect.x_scnlen.u64 =3D 0; - a->x_csect.x_smtyp =3D (2 << 3) | XTY_SD; + a->u.auxent.x_csect.x_scnlen.u64 =3D 0; + a->u.auxent.x_csect.x_smtyp =3D (2 << 3) | XTY_SD; } else if (symbol_get_tc (sym)->subseg !=3D 0) { /* This is a csect symbol. x_scnlen is the size of the csect. */ if (symbol_get_tc (sym)->next =3D=3D (symbolS *) NULL) - a->x_csect.x_scnlen.u64 + a->u.auxent.x_csect.x_scnlen.u64 =3D bfd_section_size (S_GET_SEGMENT (sym)) - S_GET_VALUE (sym); else { resolve_symbol_value (symbol_get_tc (sym)->next); - a->x_csect.x_scnlen.u64 + a->u.auxent.x_csect.x_scnlen.u64 =3D S_GET_VALUE (symbol_get_tc (sym)->next) - S_GET_VALUE (sym); } if (symbol_get_tc (sym)->symbol_class =3D=3D XMC_BS || symbol_get_tc (sym)->symbol_class =3D=3D XMC_UL) - a->x_csect.x_smtyp =3D (symbol_get_tc (sym)->align << 3) | XTY_CM; + a->u.auxent.x_csect.x_smtyp + =3D (symbol_get_tc (sym)->align << 3) | XTY_CM; else - a->x_csect.x_smtyp =3D (symbol_get_tc (sym)->align << 3) | XTY_SD; + a->u.auxent.x_csect.x_smtyp + =3D (symbol_get_tc (sym)->align << 3) | XTY_SD; } else if (S_GET_SEGMENT (sym) =3D=3D bss_section || S_GET_SEGMENT (sym) =3D=3D ppc_xcoff_tbss_section.segment) { /* This is a common symbol. */ - a->x_csect.x_scnlen.u64 =3D symbol_get_frag (sym)->fr_offset; - a->x_csect.x_smtyp =3D (symbol_get_tc (sym)->align << 3) | XTY_CM; + a->u.auxent.x_csect.x_scnlen.u64 =3D symbol_get_frag (sym)->fr_offset; + a->u.auxent.x_csect.x_smtyp + =3D (symbol_get_tc (sym)->align << 3) | XTY_CM; if (S_GET_SEGMENT (sym) =3D=3D ppc_xcoff_tbss_section.segment) symbol_get_tc (sym)->symbol_class =3D XMC_UL; else if (S_IS_EXTERNAL (sym)) @@ -6244,15 +6247,15 @@ ppc_frob_symbol (symbolS *sym) /* This is an absolute symbol. The csect will be created by ppc_adjust_symtab. */ ppc_saw_abs =3D true; - a->x_csect.x_smtyp =3D XTY_LD; + a->u.auxent.x_csect.x_smtyp =3D XTY_LD; if (symbol_get_tc (sym)->symbol_class =3D=3D -1) symbol_get_tc (sym)->symbol_class =3D XMC_XO; } else if (! S_IS_DEFINED (sym)) { /* This is an external symbol. */ - a->x_csect.x_scnlen.u64 =3D 0; - a->x_csect.x_smtyp =3D XTY_ER; + a->u.auxent.x_csect.x_scnlen.u64 =3D 0; + a->u.auxent.x_csect.x_smtyp =3D XTY_ER; } else if (ppc_is_toc_sym (sym)) { @@ -6267,19 +6270,19 @@ ppc_frob_symbol (symbolS *sym) || (!ppc_is_toc_sym (next))) { if (ppc_after_toc_frag =3D=3D (fragS *) NULL) - a->x_csect.x_scnlen.u64 + a->u.auxent.x_csect.x_scnlen.u64 =3D bfd_section_size (data_section) - S_GET_VALUE (sym); else - a->x_csect.x_scnlen.u64 + a->u.auxent.x_csect.x_scnlen.u64 =3D ppc_after_toc_frag->fr_address - S_GET_VALUE (sym); } else { resolve_symbol_value (next); - a->x_csect.x_scnlen.u64 + a->u.auxent.x_csect.x_scnlen.u64 =3D S_GET_VALUE (next) - S_GET_VALUE (sym); } - a->x_csect.x_smtyp =3D (2 << 3) | XTY_SD; + a->u.auxent.x_csect.x_smtyp =3D (2 << 3) | XTY_SD; } else { @@ -6302,7 +6305,7 @@ ppc_frob_symbol (symbolS *sym) if (csect =3D=3D (symbolS *) NULL) { as_warn (_("warning: symbol %s has no csect"), S_GET_NAME (sym)); - a->x_csect.x_scnlen.u64 =3D 0; + a->u.auxent.x_csect.x_scnlen.u64 =3D 0; } else { @@ -6315,22 +6318,21 @@ ppc_frob_symbol (symbolS *sym) csect =3D symbol_get_tc (csect)->next; } =20 - a->x_csect.x_scnlen.p =3D - coffsymbol (symbol_get_bfdsym (csect))->native; - coffsymbol (symbol_get_bfdsym (sym))->native[i + 1].fix_scnlen =3D - 1; + a->u.auxent.x_csect.x_scnlen.p + =3D coffsymbol (symbol_get_bfdsym (csect))->native; + a->fix_scnlen =3D 1; } - a->x_csect.x_smtyp =3D XTY_LD; + a->u.auxent.x_csect.x_smtyp =3D XTY_LD; } =20 - a->x_csect.x_parmhash =3D 0; - a->x_csect.x_snhash =3D 0; + a->u.auxent.x_csect.x_parmhash =3D 0; + a->u.auxent.x_csect.x_snhash =3D 0; if (symbol_get_tc (sym)->symbol_class =3D=3D -1) - a->x_csect.x_smclas =3D XMC_PR; + a->u.auxent.x_csect.x_smclas =3D XMC_PR; else - a->x_csect.x_smclas =3D symbol_get_tc (sym)->symbol_class; - a->x_csect.x_stab =3D 0; - a->x_csect.x_snstab =3D 0; + a->u.auxent.x_csect.x_smclas =3D symbol_get_tc (sym)->symbol_class; + a->u.auxent.x_csect.x_stab =3D 0; + a->u.auxent.x_csect.x_snstab =3D 0; =20 /* Don't let the COFF backend resort these symbols. */ symbol_get_bfdsym (sym)->flags |=3D BSF_NOT_AT_END; @@ -6423,7 +6425,7 @@ ppc_adjust_symtab (void) { symbolS *csect; int i; - union internal_auxent *a; + combined_entry_type *a; =20 if (S_GET_SEGMENT (sym) !=3D absolute_section) continue; @@ -6434,21 +6436,22 @@ ppc_adjust_symtab (void) S_SET_STORAGE_CLASS (csect, C_HIDEXT); i =3D S_GET_NUMBER_AUXILIARY (csect); S_SET_NUMBER_AUXILIARY (csect, i + 1); - a =3D &coffsymbol (symbol_get_bfdsym (csect))->native[i + 1].u.auxen= t; - a->x_csect.x_scnlen.u64 =3D 0; - a->x_csect.x_smtyp =3D XTY_SD; - a->x_csect.x_parmhash =3D 0; - a->x_csect.x_snhash =3D 0; - a->x_csect.x_smclas =3D XMC_XO; - a->x_csect.x_stab =3D 0; - a->x_csect.x_snstab =3D 0; + a =3D &coffsymbol (symbol_get_bfdsym (csect))->native[i + 1]; + a->u.auxent.x_csect.x_scnlen.u64 =3D 0; + a->u.auxent.x_csect.x_smtyp =3D XTY_SD; + a->u.auxent.x_csect.x_parmhash =3D 0; + a->u.auxent.x_csect.x_snhash =3D 0; + a->u.auxent.x_csect.x_smclas =3D XMC_XO; + a->u.auxent.x_csect.x_stab =3D 0; + a->u.auxent.x_csect.x_snstab =3D 0; =20 symbol_insert (csect, sym, &symbol_rootP, &symbol_lastP); =20 i =3D S_GET_NUMBER_AUXILIARY (sym); - a =3D &coffsymbol (symbol_get_bfdsym (sym))->native[i].u.auxent; - a->x_csect.x_scnlen.p =3D coffsymbol (symbol_get_bfdsym (csect))->na= tive; - coffsymbol (symbol_get_bfdsym (sym))->native[i].fix_scnlen =3D 1; + a =3D &coffsymbol (symbol_get_bfdsym (sym))->native[i]; + a->u.auxent.x_csect.x_scnlen.p + =3D coffsymbol (symbol_get_bfdsym (csect))->native; + a->fix_scnlen =3D 1; } =20 ppc_saw_abs =3D false;