Skip to content

Please add support for ms_hook_prologue function attribute #10584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
llvmbot opened this issue Jun 28, 2011 · 12 comments
Open

Please add support for ms_hook_prologue function attribute #10584

llvmbot opened this issue Jun 28, 2011 · 12 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category enhancement Improving things as opposed to bug fixing, e.g. new or missing feature platform:windows

Comments

@llvmbot
Copy link
Member

llvmbot commented Jun 28, 2011

Bugzilla Link 10212
Version trunk
OS Linux
Blocks #7187 llvm/llvm-bugzilla-archive#10638
Reporter LLVM Bugzilla Contributor
CC @AaronBallman,@jeremyhu,@tritao,@nlewycky,@zygoloid,@rnk
@llvmbot
Copy link
Member Author

llvmbot commented Jun 28, 2011

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.

@llvmbot
Copy link
Member Author

llvmbot commented Feb 14, 2012

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

@tritao
Copy link
Mannequin

tritao mannequin commented Aug 29, 2012

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.

@AaronBallman
Copy link
Collaborator

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.

@AaronBallman
Copy link
Collaborator

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

@llvmbot
Copy link
Member Author

llvmbot commented Mar 9, 2016

Any progress?

@nlewycky
Copy link
Contributor

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

@llvmbot
Copy link
Member Author

llvmbot commented Nov 26, 2021

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

@AaronBallman
Copy link
Collaborator

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

@llvmbot
Copy link
Member Author

llvmbot commented Nov 27, 2021

mentioned in issue #7187

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
@ThisNekoGuy
Copy link

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

@AaronBallman
Copy link
Collaborator

This seems far more likely now that Clang supports -fms-hotpatch as a command line argument: 5af2433. 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.

@AaronBallman AaronBallman added platform:windows enhancement Improving things as opposed to bug fixing, e.g. new or missing feature and removed missing-feature labels Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category enhancement Improving things as opposed to bug fixing, e.g. new or missing feature platform:windows
Projects
None yet
Development

No branches or pull requests

4 participants