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: MIPS JAL/JALR to BAL transformation for Linux (o32 ABI)


> Fu, Chao-Ying wrote:
>> .globl __start
>>         .space 8
>> .ent __start
>> __start:
>> .Lstart:
>>         .space 16
>>         jal __start <------------ NOT relaxed
>>         .space 32
>>         jal __start <------------ NOT relaxed
>>         .space 64
>>         jal .Lstart <------------ relaxed
>> .end __start
>> 
>> # make objdump print ...
>>         .space 8
>> 
>>   The first two JALRs aren't relaxed in 
>> "_bfd_mips_relax_section" due to the check.
>> as follows.
>> /* If a symbol is undefined, or if it may be overridden,
>>    skip it.  */
>> if (! ((h->root.root.type == bfd_link_hash_defined
>>         || h->root.root.type == bfd_link_hash_defweak)
>>        && h->root.root.u.def.section)
>>     || (link_info->shared && ! link_info->symbolic
>>         && ! (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)))
>>   continue;
>> 
>>   But later, these two JALRs are transformed to BAL in 
>> "mips_elf_perform_relocation".
>> Is it safe to use BAL for the first two JALRs?

No it's not safe in a shared library unless -Bsymbolic is used.  This is
actually causing a regression with my GCC testing of the R_MIPS_JALR
patch.  It seems that my patch:

http://sourceware.org/ml/binutils/2009-08/msg00404.html

needs to exclude global symbols in shared libs just like it's done under
relaxation.  I'll update that patch.

Also did you test your binutils R_MIPS_JALR patch with a GCC bootstrap?
If not then next time you probably should.  The binutils testsuite is
not very good in this area and I don't think the problems I have found
since your patch are "-mexplicit-relocs"-specific.

>> And, the relaxation code seems redundant, after we can do the 
>> same thing in
>> "mips_elf_perform_relocation".

Yes, it does seem redundant.

Adam


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