This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
mips-elf linker error: jump to stub routine which is not jal
- From: "Ting-Cheng Hsu" <tc-hsu at ali dot com dot tw>
- To: binutils at sources dot redhat dot com
- Date: Thu, 15 Nov 2001 14:56:26 +0800
- Subject: mips-elf linker error: jump to stub routine which is not jal
Hello,
I got the error message from ld when I compiled and linked
the following assembly code:
.set mips1
_start:
la v0, m16_start
jr v0
nop
.set mips16
m16_start:
addiu v1, 2
...
...
Searching for binutils mail archives, the cause is stated
in http://sources.redhat.com/ml/binutils/1999-12/msg00021.html.
The linker would consider the reference of m16_start to be
error since it's not a jal(x) instruction which needs relocation.
If the restriction does exist, then I won't be able to write
codes like the above example, right?
According to the require_jalxp statement 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));
the same "la" peudo-instruction in mips16 code region which
references a label in mips32 code region won't generate the
"jump to stub ..." error message.
I modified bfd/elf32-mips.c to the following (Dmitri's solution
in msg00021.html):
*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)));
the above assembly code is successfully linked. But I have another
problem :(
When I link a simple C code against newlib stdlib (mips16 MULTILIB),
numerous error messages come out:
/usr/local/mips/mips-elf/lib/soft-float/mips16/libc.a(dtoa.o): In function `_dto
a_r':
/home/hsutc/mips-dev-tool/build/gcc-2.95.3/mips-elf/soft-float/mips16/newlib/lib
c/stdlib/../../../../../../../../source/gcc-2.95.3/newlib/libc/stdlib/dtoa.c:392
: undefined reference to `$L57'
/home/hsutc/mips-dev-tool/build/gcc-2.95.3/mips-elf/soft-float/mips16/newlib/lib
c/stdlib/../../../../../../../../source/gcc-2.95.3/newlib/libc/stdlib/dtoa.c:392
: undefined reference to `$L57'
/home/hsutc/mips-dev-tool/build/gcc-2.95.3/mips-elf/soft-float/mips16/newlib/lib
c/stdlib/../../../../../../../../source/gcc-2.95.3/newlib/libc/stdlib/dtoa.c:392
: undefined reference to `$L58'
/home/hsutc/mips-dev-tool/build/gcc-2.95.3/mips-elf/soft-float/mips16/newlib/lib
c/stdlib/../../../../../../../../source/gcc-2.95.3/newlib/libc/stdlib/dtoa.c:392
: undefined reference to `$L61'
/home/hsutc/mips-dev-tool/build/gcc-2.95.3/mips-elf/soft-float/mips16/newlib/lib
c/stdlib/../../../../../../../../source/gcc-2.95.3/newlib/libc/stdlib/dtoa.c:392
: undefined reference to `$L59'
/home/hsutc/mips-dev-tool/build/gcc-2.95.3/mips-elf/soft-float/mips16/newlib/lib
c/stdlib/../../../../../../../../source/gcc-2.95.3/newlib/libc/stdlib/dtoa.c:392
: undefined reference to `$L62'
(many "undefined reference" follows)
Beginning from line 392 of dtoa.c is the following code:
switch (mode)
{
case 0:
case 1:
i = 18;
ndigits = 0;
break;
case 2:
leftright = 0;
/* no break */
case 4:
if (ndigits <= 0)
ndigits = 1;
ilim = ilim1 = i = ndigits;
break;
case 3:
leftright = 0;
/* no break */
case 5:
i = ndigits + k + 1;
ilim = i;
ilim1 = i - 1;
if (i <= 0)
i = 1;
}
Here the six cases map to the six '$Lxx' undefined reference, right?
Why would this happen? Does it relate to the modification of
elf32-mips.c (surely it does)? If the '*require_jalxp' assignment is
really a bug, why is it still not fixed in recent release of binutils?
My ultimate goal: mixing 16 bit and 32 bit mips codes without errors.
Anyone has any ideas? Thanks for any help.
Regards,
Ting-Cheng
Acer Labs, Inc.