This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: [RFC,GAS]Propose to emit the attribute section after relaxation


On Thu, Sep 18, 2014 at 4:15 PM, Alan Modra <amodra@gmail.com> wrote:
> On Wed, Sep 17, 2014 at 08:06:24PM +0800, Terry Guo wrote:
>> Hi there,
>>
>> For targets like ARM, some architecture related attributes can only be
>> finalized after relaxation step due to relaxable instructions. By then the
>> attribute section is already emitted,  there is no chance to update the
>> emitted attribute section.
>
> Yes, I can see that the size of the attribute section might change if
> you want to change attributes.
>

Thanks for the comments. You are right. The size will change.

>> At least I tried and couldn't find a way to do
>> so. In order to take into account the relaxation, I propose to emit
>> attribute section after relaxation step.
>
> That sounds reasonable.  What you've done in the patch though is put
> the create_obj_attrs_section call later than relax_seg, after
> size_seg.  Is there a reason you can't call create_obj_attrs_section
> immediately after the relax_seg loop?
>
> --
> Alan Modra
> Australia Development Lab, IBM

There are two reasons for this. I think it's better to create
attribute section as later as possible, so that we can take into
account factors that would impact attributes as much as possible.
Another reason is to take advantage of the md_post_relax_hook. Usually
relax_seg is called section by section, which means it updates things
piece by piece. By using the md_post_relax_hook, we can summary things
there and make sure all pieces fit together correctly. Here is an
example for ARM:
1). Inside relax_seg, when a relaxable instruction is actually
promoted to 32bit instruction, I then set thumb2 attribute to true.
2). After the relaxation step, in md_post_relax_hook I call
aeabi_set_public_attributes again to consolidate all the updated
attributes and make sure everything ok.
3). Now we create attribute section.

Other targets can use md_post_relax_hook to do similar things.

Maybe we can move both md_post_relax_hook and create_obj_attrs_section
before the size_seg. What do you think?

BR,
Terry


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