[RFC PATCH] .bundle_align_mode

nick clifton nickc@redhat.com
Thu Feb 16 11:03:00 GMT 2012


Hi Roland,

>> * It might be useful to mention in the documentation why this feature is
>> needed.
>
> Oh, in the documentation?  I was all set to explain it to you here.

Actually both is good.

> The short version is, "For some
> targets, it's an ABI requirement that no instruction may span a certain
> aligned boundary."  Is that what you had in mind?

For the documentation, yes, thanks.


>> * What about instructions with delay slots ?
>
> That's a good question.  I hadn't thought about it, since so far I've only
> considered CPUs that don't have delay slots.  The only machine with delay
> slots that I know anything about is sparc, so if my logic doesn't hold for
> some other machine you know about, you'll have to educate me.
>
> On machines like sparc, where all instructions are the same size, I don't
> think there is any problem.

Good point - I do not know of any architectures with both variable sized 
insns and delay slots.  Although... what about anulling instructions ? 
The RL78 for example has variable length instructions, one of which is 
the SKC instruction (skip following if carry set).  Note: I have no 
problems with you specifying that .bundle_align_mode will not work with 
such architectures.  I just wanted to raise the possibility of awkward 
targets.


>>> +@section @code{.bundle_lock} and @code{.bundle_unlock}
>>
>> * Can these directives be nested ?
>
> As I've specified it, no.
[snip]
> For now, I've added a couple of sentences to the
> documentation to make it explicit that nesting is not allowed.

Fair enough.


>> * Presumably once a bundle has been created by the assembler, it needs to be
>> preserved by the linker.  Thus it seems to me that you are going to need a
>> reloc or two to tell the linker about the bundle.
>
> I don't think there's any need for this, but perhaps you have something in
> mind that I don't know about.

I was thinking specifically of linker relaxation where the linker can 
replace longer instruction sequences with shorter ones.   Targets that 
support this feature already have special relocs to handle normal 
alignment requirements, so I expect that it would be fairly easy to add 
another one to cope with bundle lengths.  Or just refuse to support 
bundle_align_mode and linker relaxation in the same target.

I was also considering the case where a linker script (or user) 
specifies an alignment for a section that is less than a bundle's 
alignment.  Or when the user links with the --nmagic command line 
option.  Both of these can break bundle alignment.   Hmm, but they break 
section alignment requirements in general and the linker does not 
complain about that.  So I guess that it is caveat-user.  If you request 
a reduced alignment then you should know what you are doing.


Cheers
   Nick



More information about the Binutils mailing list