Hi, According to http://blogs.msdn.com/b/freik/archive/2006/03/07/x64-hotpatchability.aspx, 'hotpatchable' functions on x86 (and by extension, x86-64) are preceded by six bytes of padding and start with a two byte instruction. The problem is that, still being relatively unfamiliar with the x86 backend, I have no idea how to implement this for the 'hotpatch' attribute I just added. I do remember the emitPrologue() method from when I was working on the alignstack() attribute, but I still don't know how to implement the first part (the six bytes of padding). Does anyone have any pointers? Chip
Michael Spencer
2010-Oct-26 23:24 UTC
[LLVMdev] Implementing the hotpatch attribute for X86
On Tue, Oct 26, 2010 at 7:02 PM, Charles Davis <cdavis at mymail.mines.edu> wrote:> Hi, > > According to > http://blogs.msdn.com/b/freik/archive/2006/03/07/x64-hotpatchability.aspx, > 'hotpatchable' functions on x86 (and by extension, x86-64) are preceded > by six bytes of padding and start with a two byte instruction. The > problem is that, still being relatively unfamiliar with the x86 backend, > I have no idea how to implement this for the 'hotpatch' attribute I just > added. I do remember the emitPrologue() method from when I was working > on the alignstack() attribute, but I still don't know how to implement > the first part (the six bytes of padding). Does anyone have any pointers? > > ChipThe linker adds the padding. Also, the first instruction just has to be two bytes or longer. Not exactly two bytes. - Michael Spencer
On 10/26/10 5:24 PM, Michael Spencer wrote:> The linker adds the padding. Also, the first instruction just has to > be two bytes or longer. Not exactly two bytes.How then does the linker know to add the padding? I assume there's a PE-COFF attribute that will do that, but what about other file formats, like ELF or Mach-O? Bear in mind that I'm doing this for the Wine project, so I'm very concerned about those two formats. Chip
Maybe Matching Threads
- [LLVMdev] Implementing the hotpatch attribute for X86
- [LLVMdev] Implementing the hotpatch attribute for X86
- [LLVMdev] [patch] Add the returns_twice attribute
- [LLVMdev] Implementing the hotpatch attribute for X86
- [LLVMdev] Problems with custom calling convention on Mac OS X