doj转换为o文件的规则:
(1) 机器码的转换: 0x22 => 0x6a
(2) 段名的转换:(默认情况)
program => .text
constdata => .rodata
data1 => .data
rela.program => .rela.text
rela.data1 => .rela.data 当然预留“用户可以自定义”功能
(3) 重定位偏移地址加2: *r_fset += *r_offset
(4) 重定位类型修整:
a) 如果出现 *r_type = 0xd2 ,则删除该符号;
b) *r_type = 0xe (it means call.x) => *r_type = 0xa (it means call)
c) 如果在同一偏移地址出现*r_type = 0xe0,*r_type = 0xe1, *r_type = 0xe2,*r_type = 0x6,则删除*r_type = 0xe0, *r_type = 0xe2,*r_type = 0x6对应的符号, 然后在*r_type = 0xe1的对应的符号的定位类型修改为,*r_type = 0x6,符号名修改成*r_type = 0xe0对应的符号; 在同一偏移地址出现*r_type = 0xe0,*r_type = 0xe1, *r_type = 0xe2,*r_type = 0x7,处理过程一样。