正确的 mips elf32 上的非法指令

illegal instruction on correct mips elf32

基本上我有这个盒子:

# cat proc/cpuinfo 
system type             : RTL8672
processor               : 0
cpu model               : 56322
BogoMIPS                : 619.31
tlb_entries             : 64
mips16 implemented      : yes

    cat proc/version 
    Linux version 2.6.30.9 (xia@njzd) (gcc version 4.4.6 (Realtek RSDK-1.5.6p2) ) #2 Wed Apr 29 18:57:54 CST 2015

这是程序在盒子上的样子

$ readelf -a httpd 
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x4a1330
  Start of program headers:          52 (bytes into file)
  Start of section headers:          816092 (bytes into file)
  Flags:                             0x1007, noreorder, pic, cpic, o32, mips1
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         24
  Section header string table index: 23

这是交叉编译后我的

$ readelf -a File2 
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x400280
  Start of program headers:          52 (bytes into file)
  Start of section headers:          651896 (bytes into file)
  Flags:                             0x1007, noreorder, pic, cpic, o32, mips1
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         33
  Section header string table index: 30

但是当我 运行 File2 时我得到 illegal instruction,我怀疑交叉编译器使用 BLA 指令而我的盒子不支持那个,如何我可以告诉我的 mips 交叉编译用其他指令替换 BLA 吗? In this 邮件列表他们谈论 JAL/JALRBAL 转换 Linux (o32 ABI),任何提示?

cat proc/cpuinfo

system type: RTL8672

processor: 0

cpu model : 56322

RTL8672 不是完整的 MIPS 实现,而是 Lexra。您将需要知道如何处理此问题的自定义工具链。

像这样

https://github.com/infinite-monkeys/rtl8672-toolchain

或对于仅二进制工具链,查找 'rsdk'

例如https://github.com/KrabbyPatty/rtl819x-toolchain/tree/master/toolchain