< 返回版块

liuxc0116 发表于 2021-06-07 16:23

Tags:编译,pie

在交叉编译时,生成的可执行文件的类型是

$ readelf -h myexe
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x8d20
  Start of program headers:          52 (bytes into file)
  Start of section headers:          3091288 (bytes into file)
  Flags:                             0x70001007, noreorder, pic, cpic, o32, mips32r2
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         11
  Size of section headers:           40 (bytes)
  Number of section headers:         44
  Section header string table index: 43

但是这个可执行文件在路由器上执行不了,报错 -ash: ./myexe: not found 路由器内核是3.10 mipsle平台的。 请问如何在Cargo编译时制定gcc的flag-no-pie 禁止生成DYN类型的可执行文件?

评论区

写评论

还没有评论

1 共 0 条评论, 1 页