llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.38k stars 12.14k forks source link

Please add support for ms_hook_prologue function attribute #10584

Open llvmbot opened 13 years ago

llvmbot commented 13 years ago
Bugzilla Link 10212
Version trunk
OS Linux
Blocks llvm/llvm-project#7187 llvm/llvm-bugzilla-archive#10638
Reporter LLVM Bugzilla Contributor
CC @AaronBallman,@jeremyhu,@tritao,@nlewycky,@zygoloid,@rnk
llvmbot commented 3 years ago

mentioned in issue llvm/llvm-project#7187

AaronBallman commented 3 years ago

mentioned in issue llvm/llvm-bugzilla-archive#20888

llvmbot commented 3 years ago

mentioned in issue llvm/llvm-bugzilla-archive#10638

nlewycky commented 5 years ago

This feature was temporarily added in August 2016, then reverted almost immediately thereafter:

llvmbot commented 8 years ago

Any progress?

AaronBallman commented 9 years ago

Bug llvm/llvm-bugzilla-archive#20888 has been marked as a duplicate of this bug.

AaronBallman commented 11 years ago

I just noticed Clang already abstracts this on the CGCXXABI object (EmitInstanceFunctionProlog), so it should be pretty to hook it up on the compiler once the LLVM part is done.

Instance functions aren't the only ones which would want this prologue. This is most commonly used on non-instance methods and corresponds to the /hotpatch MSVC option: http://msdn.microsoft.com/en-us/library/ms173507.aspx

What's more, it's not x86-specific (we should support it for x64 and Itanium targets as well, where it can require more than just the five-byte prologue).

For MSVC compatibility, we should consider adding a flag letting you turn this feature on or off for an entire file instead of requiring an attribute. Not saying that we shouldn't also support the function attribute.

568fcb21-d0ce-4a26-8906-01a793566e5c commented 12 years ago

I just noticed Clang already abstracts this on the CGCXXABI object (EmitInstanceFunctionProlog), so it should be pretty to hook it up on the compiler once the LLVM part is done.

llvmbot commented 12 years ago

Still present, as of git-svn-id: http://llvm.org/svn/llvm-project/llvm/trunk@150433 91177308-0d34-0410-b5e6-96231b3b80d8

llvmbot commented 13 years ago

Sorry, hit tab one to many times before hitting Submit :)

gcc added support for this a couple years ago (Sep 2009), and has been in since gcc 4.5. It's used by Wine to allow programs to hook certain APIs. Without this, Steam, xfire, and several copy protections/DRM schemes fail to function.

ThisNekoGuy commented 2 years ago

Hope this gets fixed soon so that it can be utilized when compiling Wine :/ This is a decade-old issue

AaronBallman commented 2 years ago

This seems far more likely now that Clang supports -fms-hotpatch as a command line argument: https://github.com/llvm/llvm-project/commit/5af2433e1794ebf7e58e848aa612c7912d71dc78. I think it may be a matter of exposing the attribute and checking for it in CodeGenFunction::StartFunction(), though there would probably be some fit and finish work as well.