Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.35 KB

200904221421.txt.md

File metadata and controls

44 lines (32 loc) · 1.35 KB

24.16 relocation truncated to fit: R_MIPS_PC16 against `no symbol'

http://scz.617.cn/unix/200904221421.txt

D: scz@nsfocus 2009-04-22 14:21

$ as -v GNU assembler version 2.18.0 (mips-linux-gnu) using BFD version (GNU Binutils for Debian) 2.18.0.20080103 $ gcc-2.95 -v gcc version 2.95.4 20011002 (Debian prerelease)


int main ( int argc, char * argv[] ) { asm volatile ("

nop

any_label:

nop
/*
 * 编写源代码时这里犯了一个低级错误,j后面没有写target
 */
j
nop

");

return( 0 );

} /* end of main */

$ gcc-2.95 -Wall -pipe -O0 -o mips_inline_asm mips_inline_asm.c /tmp/ccDoinnr.o: In function any_label': mips_inline_asm.c:(.text+0x2c): relocation truncated to fit: R_MIPS_PC16 against no symbol' collect2: ld returned 1 exit status

这是我简化后的情形,已经很容易发现问题根源。最初是写一个较复杂的嵌入式汇编 代码,中间某处j后面没有写target,编译、汇编阶段均未报错或警告,一直到链接 阶段来了一段类似上述输出的错误信息,折腾了半天,直至偶然发现j后无target。

在此记录备忘,以后排错时可参考。