This is the mail archive of the binutils@sourceware.cygnus.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]

bfd/elf32-mips.c - a small change.


Chasing a linker bug (it wouldn't link a module, giving me the message:
"jump to stub routine which is not jal")  I found these lines in
bfd/elf32-mips.c

  /* Calls from 16-bit code to 32-bit code and vice versa require the
     special jalx instruction.  */
  *require_jalxp = (!info->relocateable
      && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p));

When r_type equals for example R_MIPS_32, *require_jalxp is set
to 'true' too, although the relocation is not for a call/jump insn
at all.  As it happens next, ld, given require_jalxp is true, checks
whether the relocation entry is jal/jalx insn, extracting its opcode
which is meaningless in this case (the entry is not an insn at all,
but maybe a function pointer or whatever address that needs 32 bit
relocation).

I changed the condition to be as follows and it worked for me just
fine so far.  Here's my question -- is this enough?  Does it actually
perform the required check of calls from 16-bit to 32-bit code and v.v.?

  *require_jalxp = (!info->relocateable
      && (((r_type == R_MIPS16_26) && !target_is_16_bit_code_p)
   || ((r_type == R_MIPS_26) && target_is_16_bit_code_p)));

Regards,
Dmitri.



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