Harmonize and improve auxiliary entries support for XCOFF

bfd/ChangeLog:
	* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Add errors for
	unsupported storage class or auxialiry entries.
	Improve and adapt to new aux structures.
	Add C_DWARF support.
	(_bfd_xcoff_swap_aux_out): Likewise.
	* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
	(_bfd_xcoff64_swap_aux_out): Likewise.

binutils/ChangeLog:
	* od-xcoff.c (dump_xcoff32_symbols): Adapt to new
	aux structures.

include/ChangeLog:
	* coff/internal.h (union internal_auxent):
	 Add x_sect structure.
	* coff/rs6000.h (union external_auxent): Rework to
	match official documentation.
	* coff/rs6k64.h (union external_auxent): Likewise.
	(_AUX_SECT): New define.
This commit is contained in:
Cl?ment Chigot 2021-04-22 12:28:50 +01:00 committed by Nick Clifton
parent d018cd835c
commit b11b2969a9
9 changed files with 326 additions and 302 deletions

View file

@ -1,3 +1,13 @@
2021-04-22 Clément Chigot <clement.chigot@atos.net>
* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Add errors for
unsupported storage class or auxialiry entries.
Improve and adapt to new aux structures.
Add C_DWARF support.
(_bfd_xcoff_swap_aux_out): Likewise.
* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
(_bfd_xcoff64_swap_aux_out): Likewise.
2021-04-21 Eli Zaretskii <eliz@gnu.org> 2021-04-21 Eli Zaretskii <eliz@gnu.org>
PR 27760 PR 27760

View file

@ -470,14 +470,22 @@ _bfd_xcoff_swap_sym_out (bfd *abfd, void * inp, void * extp)
} }
void void
_bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type, int in_class, _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type ATTRIBUTE_UNUSED,
int indx, int numaux, void * in1) int in_class, int indx, int numaux, void * in1)
{ {
AUXENT * ext = (AUXENT *)ext1; AUXENT * ext = (AUXENT *)ext1;
union internal_auxent *in = (union internal_auxent *)in1; union internal_auxent *in = (union internal_auxent *)in1;
switch (in_class) switch (in_class)
{ {
default:
_bfd_error_handler
/* xgettext: c-format */
(_("%pB: unsupported swap_aux_in for storage class %#x"),
abfd, (unsigned int) in_class);
bfd_set_error (bfd_error_bad_value);
break;
case C_FILE: case C_FILE:
if (ext->x_file.x_n.x_fname[0] == 0) if (ext->x_file.x_n.x_fname[0] == 0)
{ {
@ -486,21 +494,13 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type, int in_class,
H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset); H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset);
} }
else else
{
if (numaux > 1)
{
if (indx == 0)
memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname,
numaux * sizeof (AUXENT));
}
else
{
memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN); memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
} break;
}
goto end;
/* RS/6000 "csect" auxents */ /* RS/6000 "csect" auxents.
There is always a CSECT auxiliary entry. But functions can
have FCN ones too. In this case, CSECT is always the last
one. */
case C_EXT: case C_EXT:
case C_AIX_WEAKEXT: case C_AIX_WEAKEXT:
case C_HIDEXT: case C_HIDEXT:
@ -516,15 +516,20 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type, int in_class,
in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas); in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas);
in->x_csect.x_stab = H_GET_32 (abfd, ext->x_csect.x_stab); in->x_csect.x_stab = H_GET_32 (abfd, ext->x_csect.x_stab);
in->x_csect.x_snstab = H_GET_16 (abfd, ext->x_csect.x_snstab); in->x_csect.x_snstab = H_GET_16 (abfd, ext->x_csect.x_snstab);
goto end; }
else
{
/* x_exptr isn't supported. */
in->x_sym.x_misc.x_fsize
= 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
= H_GET_32 (abfd, ext->x_fcn.x_endndx);
} }
break; break;
case C_STAT: case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL)
{
in->x_scn.x_scnlen = H_GET_32 (abfd, ext->x_scn.x_scnlen); in->x_scn.x_scnlen = H_GET_32 (abfd, ext->x_scn.x_scnlen);
in->x_scn.x_nreloc = H_GET_16 (abfd, ext->x_scn.x_nreloc); in->x_scn.x_nreloc = H_GET_16 (abfd, ext->x_scn.x_nreloc);
in->x_scn.x_nlinno = H_GET_16 (abfd, ext->x_scn.x_nlinno); in->x_scn.x_nlinno = H_GET_16 (abfd, ext->x_scn.x_nlinno);
@ -533,57 +538,25 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type, int in_class,
in->x_scn.x_checksum = 0; in->x_scn.x_checksum = 0;
in->x_scn.x_associated = 0; in->x_scn.x_associated = 0;
in->x_scn.x_comdat = 0; in->x_scn.x_comdat = 0;
goto end;
}
break; break;
}
in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx); case C_BLOCK:
in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx); case C_FCN:
in->x_sym.x_misc.x_lnsz.x_lnno
= H_GET_32 (abfd, ext->x_sym.x_lnno);
break;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type) case C_DWARF:
|| ISTAG (in_class)) in->x_sect.x_scnlen = H_GET_32 (abfd, ext->x_sect.x_scnlen);
{ in->x_sect.x_nreloc = H_GET_32 (abfd, ext->x_sect.x_nreloc);
in->x_sym.x_fcnary.x_fcn.x_lnnoptr = break;
H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
in->x_sym.x_fcnary.x_fcn.x_endndx.l =
H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
{
in->x_sym.x_fcnary.x_ary.x_dimen[0] =
H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] =
H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] =
H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] =
H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
{
in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
} }
else
{
in->x_sym.x_misc.x_lnsz.x_lnno =
H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno);
in->x_sym.x_misc.x_lnsz.x_size =
H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size);
}
end: ;
/* The semicolon is because MSVC doesn't like labels at
end of block. */
} }
unsigned int unsigned int
_bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type, int in_class, _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type ATTRIBUTE_UNUSED,
int indx ATTRIBUTE_UNUSED, int in_class, int indx, int numaux, void * extp)
int numaux ATTRIBUTE_UNUSED,
void * extp)
{ {
union internal_auxent *in = (union internal_auxent *)inp; union internal_auxent *in = (union internal_auxent *)inp;
AUXENT *ext = (AUXENT *)extp; AUXENT *ext = (AUXENT *)extp;
@ -591,6 +564,14 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type, int in_class,
memset (ext, 0, bfd_coff_auxesz (abfd)); memset (ext, 0, bfd_coff_auxesz (abfd));
switch (in_class) switch (in_class)
{ {
default:
_bfd_error_handler
/* xgettext: c-format */
(_("%pB: unsupported swap_aux_out for storage class %#x"),
abfd, (unsigned int) in_class);
bfd_set_error (bfd_error_bad_value);
break;
case C_FILE: case C_FILE:
if (in->x_file.x_fname[0] == 0) if (in->x_file.x_fname[0] == 0)
{ {
@ -599,10 +580,8 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type, int in_class,
ext->x_file.x_n.x_n.x_offset); ext->x_file.x_n.x_n.x_offset);
} }
else else
{
memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN); memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN);
} break;
goto end;
/* RS/6000 "csect" auxents */ /* RS/6000 "csect" auxents */
case C_EXT: case C_EXT:
@ -620,57 +599,34 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type, int in_class,
H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
H_PUT_32 (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); H_PUT_32 (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
H_PUT_16 (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); H_PUT_16 (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
goto end; }
else
{
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,
ext->x_fcn.x_endndx);
} }
break; break;
case C_STAT: case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL)
{
H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->x_scn.x_scnlen); H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->x_scn.x_scnlen);
H_PUT_16 (abfd, in->x_scn.x_nreloc, ext->x_scn.x_nreloc); H_PUT_16 (abfd, in->x_scn.x_nreloc, ext->x_scn.x_nreloc);
H_PUT_16 (abfd, in->x_scn.x_nlinno, ext->x_scn.x_nlinno); H_PUT_16 (abfd, in->x_scn.x_nlinno, ext->x_scn.x_nlinno);
goto end; break;
}
case C_BLOCK:
case C_FCN:
H_PUT_32 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext->x_sym.x_lnno);
break;
case C_DWARF:
H_PUT_32 (abfd, in->x_sect.x_scnlen, ext->x_sect.x_scnlen);
H_PUT_32 (abfd, in->x_sect.x_nreloc, ext->x_sect.x_nreloc);
break; break;
} }
H_PUT_32 (abfd, in->x_sym.x_tagndx.l, 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))
{
H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
{
H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
else
{
H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
ext->x_sym.x_misc.x_lnsz.x_lnno);
H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size,
ext->x_sym.x_misc.x_lnsz.x_size);
}
end:
return bfd_coff_auxesz (abfd); return bfd_coff_auxesz (abfd);
} }

View file

@ -362,15 +362,28 @@ _bfd_xcoff64_swap_sym_out (bfd *abfd, void *inp, void *extp)
} }
static void static void
_bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type, int in_class, _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type ATTRIBUTE_UNUSED,
int indx, int numaux, void *in1) int in_class, int indx, int numaux, void *in1)
{ {
union external_auxent *ext = (union external_auxent *) ext1; union external_auxent *ext = (union external_auxent *) ext1;
union internal_auxent *in = (union internal_auxent *) in1; union internal_auxent *in = (union internal_auxent *) in1;
unsigned char auxtype;
switch (in_class) switch (in_class)
{ {
default:
_bfd_error_handler
/* xgettext: c-format */
(_("%pB: unsupported swap_aux_in for storage class %#x"),
abfd, (unsigned int) in_class);
bfd_set_error (bfd_error_bad_value);
break;
case C_FILE: case C_FILE:
auxtype = H_GET_8 (abfd, ext->x_file.x_auxtype);
if (auxtype != _AUX_FILE)
goto error;
if (ext->x_file.x_n.x_n.x_zeroes[0] == 0) if (ext->x_file.x_n.x_n.x_zeroes[0] == 0)
{ {
in->x_file.x_n.x_zeroes = 0; in->x_file.x_n.x_zeroes = 0;
@ -378,17 +391,25 @@ _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type, int in_class,
H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset); H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset);
} }
else else
{
memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN); memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN);
} break;
goto end;
/* RS/6000 "csect" auxents */ /* RS/6000 "csect" auxents.
There is always a CSECT auxiliary entry. But functions can
have FCN and EXCEPT ones too. In this case, CSECT is always the last
one.
For now, we only support FCN types. */
case C_EXT: case C_EXT:
case C_AIX_WEAKEXT: case C_AIX_WEAKEXT:
case C_HIDEXT: case C_HIDEXT:
if (indx + 1 == numaux) if (indx + 1 == numaux)
{ {
/* C_EXT can have several aux enties. But the _AUX_CSECT is always
the last one. */
auxtype = H_GET_8 (abfd, ext->x_csect.x_auxtype);
if (auxtype != _AUX_CSECT)
goto error;
bfd_signed_vma h = 0; bfd_signed_vma h = 0;
bfd_vma l = 0; bfd_vma l = 0;
@ -404,55 +425,67 @@ _bfd_xcoff64_swap_aux_in (bfd *abfd, void *ext1, int type, int in_class,
byte orders. */ byte orders. */
in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp); in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp);
in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas); in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas);
goto end; }
else
{
/* It can also be a _AUX_EXCEPT entry. But it's not supported
for now. */
auxtype = H_GET_8 (abfd, ext->x_fcn.x_auxtype);
if (auxtype != _AUX_FCN)
goto error;
in->x_sym.x_fcnary.x_fcn.x_lnnoptr
= 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
= H_GET_32 (abfd, ext->x_fcn.x_endndx);
} }
break; break;
case C_STAT: case C_STAT:
case C_LEAFSTAT: _bfd_error_handler
case C_HIDDEN: /* xgettext: c-format */
if (type == T_NULL) (_("%pB: C_STAT isn't supported by XCOFF64"),
{ abfd);
/* PE defines some extra fields; we zero them out for bfd_set_error (bfd_error_bad_value);
safety. */ break;
in->x_scn.x_checksum = 0;
in->x_scn.x_associated = 0;
in->x_scn.x_comdat = 0;
goto end; case C_BLOCK:
} case C_FCN:
auxtype = H_GET_8 (abfd, ext->x_sym.x_auxtype);
if (auxtype != _AUX_SYM)
goto error;
in->x_sym.x_misc.x_lnsz.x_lnno
= H_GET_32 (abfd, ext->x_sym.x_lnno);
break;
case C_DWARF:
auxtype = H_GET_8 (abfd, ext->x_sect.x_auxtype);
if (auxtype != _AUX_SECT)
goto error;
in->x_sect.x_scnlen = H_GET_64 (abfd, ext->x_sect.x_scnlen);
in->x_sect.x_nreloc = H_GET_64 (abfd, ext->x_sect.x_nreloc);
break; break;
} }
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type) return;
|| ISTAG (in_class))
{ error:
in->x_sym.x_fcnary.x_fcn.x_lnnoptr _bfd_error_handler
= H_GET_64 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); /* xgettext: c-format */
in->x_sym.x_fcnary.x_fcn.x_endndx.l (_("%pB: wrong auxtype %#x for storage class %#x"),
= H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx); abfd, auxtype, (unsigned int) in_class);
} bfd_set_error (bfd_error_bad_value);
if (ISFCN (type))
{
in->x_sym.x_misc.x_fsize
= H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_fsize);
}
else
{
in->x_sym.x_misc.x_lnsz.x_lnno
= H_GET_32 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_lnno);
in->x_sym.x_misc.x_lnsz.x_size
= H_GET_16 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_size);
}
end: ;
} }
static unsigned int static unsigned int
_bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type, int in_class, _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type ATTRIBUTE_UNUSED,
int indx ATTRIBUTE_UNUSED, int in_class, int indx, int numaux, void *extp)
int numaux ATTRIBUTE_UNUSED,
void *extp)
{ {
union internal_auxent *in = (union internal_auxent *) inp; union internal_auxent *in = (union internal_auxent *) inp;
union external_auxent *ext = (union external_auxent *) extp; union external_auxent *ext = (union external_auxent *) extp;
@ -460,6 +493,14 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type, int in_class,
memset (ext, 0, bfd_coff_auxesz (abfd)); memset (ext, 0, bfd_coff_auxesz (abfd));
switch (in_class) switch (in_class)
{ {
default:
_bfd_error_handler
/* xgettext: c-format */
(_("%pB: unsupported swap_aux_out for storage class %#x"),
abfd, (unsigned int) in_class);
bfd_set_error (bfd_error_bad_value);
break;
case C_FILE: case C_FILE:
if (in->x_file.x_n.x_zeroes == 0) if (in->x_file.x_n.x_zeroes == 0)
{ {
@ -468,13 +509,15 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type, int in_class,
ext->x_file.x_n.x_n.x_offset); ext->x_file.x_n.x_n.x_offset);
} }
else else
{
memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN); memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN);
} H_PUT_8 (abfd, _AUX_FILE, ext->x_file.x_auxtype);
H_PUT_8 (abfd, _AUX_FILE, ext->x_auxtype.x_auxtype); break;
goto end;
/* RS/6000 "csect" auxents */ /* RS/6000 "csect" auxents.
There is always a CSECT auxiliary entry. But functions can
have FCN and EXCEPT ones too. In this case, CSECT is always the last
one.
For now, we only support FCN types. */
case C_EXT: case C_EXT:
case C_AIX_WEAKEXT: case C_AIX_WEAKEXT:
case C_HIDEXT: case C_HIDEXT:
@ -493,46 +536,40 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type, int in_class,
byte orders. */ byte orders. */
H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
H_PUT_8 (abfd, _AUX_CSECT, ext->x_auxtype.x_auxtype); H_PUT_8 (abfd, _AUX_CSECT, ext->x_csect.x_auxtype);
goto end; }
else
{
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,
ext->x_fcn.x_endndx);
H_PUT_8 (abfd, _AUX_FCN, ext->x_csect.x_auxtype);
} }
break; break;
case C_STAT: case C_STAT:
case C_LEAFSTAT: _bfd_error_handler
case C_HIDDEN: /* xgettext: c-format */
if (type == T_NULL) (_("%pB: C_STAT isn't supported by XCOFF64"),
{ abfd);
goto end; bfd_set_error (bfd_error_bad_value);
} break;
case C_BLOCK:
case C_FCN:
H_PUT_32 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext->x_sym.x_lnno);
H_PUT_8 (abfd, _AUX_SYM, ext->x_sym.x_auxtype);
break;
case C_DWARF:
H_PUT_64 (abfd, in->x_sect.x_scnlen, ext->x_sect.x_scnlen);
H_PUT_64 (abfd, in->x_sect.x_nreloc, ext->x_sect.x_nreloc);
H_PUT_8 (abfd, _AUX_SECT, ext->x_sect.x_auxtype);
break; break;
} }
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
H_PUT_64 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
H_PUT_8 (abfd, _AUX_FCN,
ext->x_auxtype.x_auxtype);
H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN (type))
{
H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize,
ext->x_sym.x_fcnary.x_fcn.x_fsize);
}
else
{
H_PUT_32 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
ext->x_sym.x_fcnary.x_lnsz.x_lnno);
H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size,
ext->x_sym.x_fcnary.x_lnsz.x_size);
}
end:
return bfd_coff_auxesz (abfd); return bfd_coff_auxesz (abfd);
} }

View file

@ -1,3 +1,8 @@
2021-04-22 Clément Chigot <clement.chigot@atos.net>
* od-xcoff.c (dump_xcoff32_symbols): Adapt to new
aux structures.
2021-04-21 Nick Lott <nick.lott@gmail.com> 2021-04-21 Nick Lott <nick.lott@gmail.com>
PR 27672 PR 27672

View file

@ -838,13 +838,13 @@ dump_xcoff32_symbols (bfd *abfd, struct xcoff_dump *data)
{ {
/* Function aux entry (Do not translate). */ /* Function aux entry (Do not translate). */
printf (" exptr: %08x fsize: %08x lnnoptr: %08x endndx: %u\n", printf (" exptr: %08x fsize: %08x lnnoptr: %08x endndx: %u\n",
(unsigned)bfd_h_get_32 (abfd, aux->x_sym.x_tagndx), (unsigned)bfd_h_get_32 (abfd, aux->x_fcn.x_exptr),
(unsigned)bfd_h_get_32 (unsigned)bfd_h_get_32
(abfd, aux->x_sym.x_misc.x_fsize), (abfd, aux->x_fcn.x_fsize),
(unsigned)bfd_h_get_32 (unsigned)bfd_h_get_32
(abfd, aux->x_sym.x_fcnary.x_fcn.x_lnnoptr), (abfd, aux->x_fcn.x_lnnoptr),
(unsigned)bfd_h_get_32 (unsigned)bfd_h_get_32
(abfd, aux->x_sym.x_fcnary.x_fcn.x_endndx)); (abfd, aux->x_fcn.x_endndx));
} }
else if (j == 1 || (j == 0 && s->sym.numaux == 1)) else if (j == 1 || (j == 0 && s->sym.numaux == 1))
{ {
@ -899,7 +899,7 @@ dump_xcoff32_symbols (bfd *abfd, struct xcoff_dump *data)
case C_FCN: case C_FCN:
printf (" lnno: %u\n", printf (" lnno: %u\n",
(unsigned)bfd_h_get_16 (unsigned)bfd_h_get_16
(abfd, aux->x_sym.x_misc.x_lnsz.x_lnno)); (abfd, aux->x_sym.x_lnno));
break; break;
default: default:
/* Do not translate - generic field name. */ /* Do not translate - generic field name. */

View file

@ -1,3 +1,12 @@
2021-04-22 Clément Chigot <clement.chigot@atos.net>
* coff/internal.h (union internal_auxent):
Add x_sect structure.
* coff/rs6000.h (union external_auxent): Rework to
match official documentation.
* coff/rs6k64.h (union external_auxent): Likewise.
(_AUX_SECT): New define.
2021-04-21 Eli Zaretskii <eliz@gnu.org> 2021-04-21 Eli Zaretskii <eliz@gnu.org>
PR 27760 PR 27760

View file

@ -659,6 +659,12 @@ union internal_auxent
/* 14 ??? */ /* 14 ??? */
#define XMC_TC0 15 /* Read-write TOC anchor */ #define XMC_TC0 15 /* Read-write TOC anchor */
#define XMC_TD 16 /* Read-write data in TOC */ #define XMC_TD 16 /* Read-write data in TOC */
struct
{
long x_scnlen; /* Section length */
long x_nreloc; /* Number of relocation entries */
} x_sect;
}; };
/********************** RELOCATION DIRECTIVES **********************/ /********************** RELOCATION DIRECTIVES **********************/

View file

@ -154,26 +154,19 @@ struct external_syment
union external_auxent { union external_auxent {
struct { struct {
char x_tagndx[4]; /* str, un, or enum tag indx */ char x_pad1[2];
union { char x_lnno[4]; /* Source line number */
struct { char x_pad[12];
char x_lnno[2]; /* declaration line number */
char x_size[2]; /* str/union/array size */
} x_lnsz;
char x_fsize[4]; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
char x_lnnoptr[4]; /* ptr to fcn line # */
char x_endndx[4]; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
char x_dimen[E_DIMNUM][2];
} x_ary;
} x_fcnary;
char x_tvndx[2]; /* tv index */
} x_sym; } x_sym;
struct {
char x_exptr[4];
char x_fsize[4];
char x_lnnoptr[4];
char x_endndx[4];
char x_pad[1];
} x_fcn;
struct { struct {
union { union {
char x_fname[E_FILNMLEN]; char x_fname[E_FILNMLEN];
@ -189,23 +182,25 @@ union external_auxent {
char x_scnlen[4]; /* section length */ char x_scnlen[4]; /* section length */
char x_nreloc[2]; /* # relocation entries */ char x_nreloc[2]; /* # relocation entries */
char x_nlinno[2]; /* # line numbers */ char x_nlinno[2]; /* # line numbers */
char x_pad[10];
} x_scn; } x_scn;
struct { struct {
char x_tvfill[4]; /* tv fill value */ char x_scnlen[4];
char x_tvlen[2]; /* length of .tv */ char x_parmhash[4];
char x_tvran[2][2]; /* tv range */ char x_snhash[2];
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */ char x_smtyp[1];
char x_smclas[1];
char x_stab[4];
char x_snstab[2];
} x_csect;
struct { struct {
unsigned char x_scnlen[4]; char x_scnlen[4];
unsigned char x_parmhash[4]; char x_pad1[4];
unsigned char x_snhash[2]; char x_nreloc[4];
unsigned char x_smtyp[1]; char x_pad2[6];
unsigned char x_smclas[1]; } x_sect;
unsigned char x_stab[4];
unsigned char x_snstab[2];
} x_csect;
}; };

View file

@ -144,19 +144,19 @@ struct external_syment
union external_auxent union external_auxent
{ {
struct {
union {
struct { struct {
char x_lnno[4]; /* declaration line number */ char x_lnno[4]; /* declaration line number */
char x_size[2]; /* str/union/array size */ char x_pad[13];
} x_lnsz; char x_auxtype[1];
} x_sym;
struct { struct {
char x_lnnoptr[8];/* ptr to fcn line */ char x_lnnoptr[8];/* ptr to fcn line */
char x_fsize[4]; /* size of function */ char x_fsize[4]; /* size of function */
char x_endndx[4]; /* entry ndx past block end */ char x_endndx[4]; /* entry ndx past block end */
char x_pad[1];
char x_auxtype[1];
} x_fcn; } x_fcn;
} x_fcnary;
} x_sym;
struct { struct {
union { union {
@ -169,6 +169,7 @@ union external_auxent
} x_n; } x_n;
unsigned char x_ftype[1]; unsigned char x_ftype[1];
unsigned char x_resv[2]; unsigned char x_resv[2];
char x_auxtype[1];
} x_file; } x_file;
struct { struct {
@ -176,22 +177,26 @@ union external_auxent
char x_fsize[4]; char x_fsize[4];
char x_endndx[4]; char x_endndx[4];
char x_pad[1]; char x_pad[1];
char x_auxtype[1];
} x_except; } x_except;
struct { struct {
unsigned char x_scnlen_lo[4]; char x_scnlen_lo[4];
unsigned char x_parmhash[4]; char x_parmhash[4];
unsigned char x_snhash[2]; char x_snhash[2];
unsigned char x_smtyp[1]; char x_smtyp[1];
unsigned char x_smclas[1]; char x_smclas[1];
unsigned char x_scnlen_hi[4]; char x_scnlen_hi[4];
unsigned char x_pad[1]; char x_pad[1];
char x_auxtype[1];
} x_csect; } x_csect;
struct { struct {
char x_pad[17]; char x_scnlen[8];
char x_nreloc[8];
char x_pad[1];
char x_auxtype[1]; char x_auxtype[1];
} x_auxtype; } x_sect;
}; };
#define SYMENT struct external_syment #define SYMENT struct external_syment
@ -207,6 +212,7 @@ union external_auxent
#define _AUX_SYM 253 #define _AUX_SYM 253
#define _AUX_FILE 252 #define _AUX_FILE 252
#define _AUX_CSECT 251 #define _AUX_CSECT 251
#define _AUX_SECT 250
/********************** RELOCATION DIRECTIVES **********************/ /********************** RELOCATION DIRECTIVES **********************/