-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from madsmtm/static-msg-send
Statically find `msgSend` functions on apple devices
- Loading branch information
Showing
7 changed files
with
103 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
use super::MsgSendFn; | ||
use crate::runtime::Imp; | ||
use crate::Encode; | ||
|
||
// TODO: C-unwind | ||
extern "C" { | ||
fn objc_msgSend(); | ||
|
||
fn objc_msgSendSuper(); | ||
} | ||
|
||
pub fn msg_send_fn<R>() -> Imp { | ||
// stret is not even available in arm64. | ||
// <https://twitter.com/gparker/status/378079715824660480> | ||
|
||
objc_msgSend | ||
} | ||
|
||
pub fn msg_send_super_fn<R>() -> Imp { | ||
objc_msgSendSuper | ||
/// `objc_msgSend_stret` is not even available in arm64. | ||
/// | ||
/// <https://twitter.com/gparker/status/378079715824660480> | ||
impl<T: Encode> MsgSendFn for T { | ||
const MSG_SEND: Imp = objc_msgSend; | ||
const MSG_SEND_SUPER: Imp = objc_msgSendSuper; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters