HexHive / retrowrite

RetroWrite -- Retrofitting compiler passes through binary rewriting
Other
655 stars 78 forks source link

[BUG] RetroWrite omits data sections #38

Open miksh opened 2 years ago

miksh commented 2 years ago

Description: RetroWrite did not create data sections, like .data.rel.ro.local, .fini.array As a result, RetroWrite not only recover certain relocation information, but also emit incorrect assembly code.

My test program has relocation information in .data.rel.ro.local

$ readelf -r  hello  | grep .data.rel.ro.local -A 20
Relocation section '.rela.data.rel.ro.local' at offset 0x9a3d8 contains 165 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000020360  000100000001 R_X86_64_64       0000000000003c90 .text + 26a0
000000020368  000100000001 R_X86_64_64       0000000000003c90 .text + 2d60
000000020370  000100000001 R_X86_64_64       0000000000003c90 .text + 26b0
000000020378  000100000001 R_X86_64_64       0000000000003c90 .text + 2e20
...

Its binary code refers .data.rel.ro.local section.

However, RetroWrite emited weird assembly code.

I examined the reassembly file and found that RetroWrite did not create .data.rel.ro.local section.

I hope to fix the errors.

Thanks.