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:
> 
> Hi All,
> 
>   I tested a new target "mips64-linux-gnu" and found new LD 
> test failures
> due to my patch.  While fixing mismatching, I found one issue 
> from a relaxation
> test "relax-jalr-n32-shared.d".
> Ex:
> # relax-jalr.s
> .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?
> And, the relaxation code seems redundant, after we can do the 
> same thing in
> "mips_elf_perform_relocation".
> 
>   The patch to fix LD failures is attached.  Thanks!
> 
> Regards,
> Chao-ying
> 
> 2009-08-07  Chao-ying Fu  <fu@mips.com>
> 
> 	* ld-mips-elf/elf-rel-got-n32.d,
> 	ld-mips-elf/elf-rel-got-n64-linux.d,
> 	ld-mips-elf/elf-rel-got-n64.d,
> 	ld-mips-elf/elf-rel-xgot-n32.d,
> 	ld-mips-elf/relax-jalr-n32-shared.d,
> 	ld-mips-elf/relax-jalr-n64-shared.d,
> 	ld-mips-elf/elf-rel-xgot-n64-linux.d,
> 	ld-mips-elf/elf-rel-xgot-n64.d: Change JALR to BAL.
> 
Hi,

  Does anyone have feedback about the safety issue (JALR->BAL) and this patch?
Thanks a lot!

Regards,
Chao-ying


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