cjacek wrote:

GCC offers the `ms_hook_prologue` function attribute as an alternative. It 
provides similar guarantees: it inserts a hardcoded prologue and adds padding. 
However, it applies on a per-function basis, so there isn’t an easy way to make 
the entire module hotpatchable. In GCC, the padding is handled directly by the 
compiler, with no linker involvement, which emits assembly like:
```
        .globl  _func
        .def    _func;  .scl    2;      .type   32;     .endef
        .long    0xcccccccc
        .long    0xcccccccc
        .long    0xcccccccc
        .long    0xcccccccc
_func:
        .byte   0x8b, 0xff, 0x55, 0x8b, 0xec
        movl    $1, %eax
        popl    %ebp
        ret
```

https://github.com/llvm/llvm-project/pull/116512
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to