[PATCH] PR 28447: implement multiple parameters for .file on XCOFF

Alan Modra amodra@gmail.com
Sun Nov 28 23:10:52 GMT 2021


On Fri, Nov 26, 2021 at 12:47:32PM -0500, Mike Frysinger via Binutils wrote:
> On 18 Oct 2021 11:37, CHIGOT, CLEMENT via Binutils wrote:
> > On XCOFF, ".file" pseudo-op allows 3 extras parameters to provide
> > additional information to AIX linker, or its debugger. These are
> > stored in auxiliary entries of the C_FILE symbol.
> >
> > --- a/bfd/coffgen.c
> > +++ b/bfd/coffgen.c
> > @@ -2135,6 +2203,12 @@ coff_print_symbol (bfd *abfd,
> >  		{
> >  		case C_FILE:
> >  		  fprintf (file, "File ");
> > +		  /* Add additional information if this isn't the filename
> > +		     auxiliary entry.  */
> > +		  if (aux)
> > +		    fprintf (file, "ftype %d fname \"%s\"",
> > +			     auxp->u.auxent.x_file.x_ftype,
> > +			     (char *) auxp->u.auxent.x_file.x_n.x_n.x_offset);
> 
> x_offset is a long and is not safe to directly cast to a pointer.  on LLP64
> sytems where sizeof(long) == 4 and sizeof(char*) == 8, this fails, and it's
> causing a build failure as a result:
> 
> bfd/coffgen.c: In function ‘coff_print_symbol’:
> bfd/coffgen.c:2221:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>  2221 |                              (char *) auxp->u.auxent.x_file.x_n.x_n.x_offset);
>       |                              ^
> -mike

Also reported as PR28630.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list