This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gas/ia64 bug: .align drops stop bit


gas v2.10.91 configured for ia64 mistranslates the following program:

	.proc foo
foo:	nop 1
	.align 16
	alloc r2 = ar.pfs, 0, 0, 0, 0
	.endp foo

The "alloc" must be preceded by a stop bit and gas is supposed to
insert that stop bit automatically but instead, it generates the
following code:

0000000000000000 <foo>:
   0:   1c 08 00 00 01 00       [MFB]       nop.m 0x1
   6:   00 00 00 02 00 00                   nop.f 0x0
   c:   00 00 00 20                         nop.b 0x0
  10:   1d 10 00 00 80 05       [MFB]       alloc r2=ar.pfs,0,0,0
  16:   00 00 00 02 00 00                   nop.f 0x0
  1c:   00 00 00 20                         nop.b 0x0;;

This error is caused by the ".align" directive: after removing it, the
generated code is fine.

Looking at the source code, the problem is due to the fact that stop
bits are normally inserted early on, as instructions are being
emitted.  Unfortunately, the ".align" directive is expanded much
later, when write.c calls cvt_frag_to_fill() and by that time, there
is no longer an easy way to know whether the code inserted by ".align"
should be terminated with a stop bit.  The existing code simply never
issues a stop bit, which is wrong for code like the above.

Does anyone have a good suggestion on how to fix this?  I suppose gas
somehow needs to recognize when it needs to set the stop bit in a
preceding bundle and that bundle will be generated by an alignment
frag, but I'm not sure how to do this reliably and cleanly.

	--david


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]