关于正确mips elf32的非法指令

时间:2015-08-01 14:16:38

标签: compiler-construction cross-platform mips

基本上我有这个盒子:

# 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?他们在讨论JAL / JALRBAL转换Linux(o32 ABI)的In this邮件列表,是否提示?

1 个答案:

答案 0 :(得分:0)

  

cat proc / cpuinfo

     

系统类型:RTL8672

     

处理器:0

     

cpu型号:56322

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

像这样的东西

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

或仅限二进制工具链,查找“rsdk”

e.g。 https://github.com/KrabbyPatty/rtl819x-toolchain/tree/master/toolchain