add selfbind functionality

This commit is contained in:
2023-07-12 13:34:02 +07:00
parent 6815ea6556
commit 4ee62a2d93
4 changed files with 305 additions and 88 deletions

View File

@ -15,6 +15,15 @@ type saveImports struct{
}
func (action *saveImports) withMacho(mf *MachoFile) error {
action.saveToInfo(mf)
mc := mf.Context()
if mc.Header().IsDylib() {
mc.WriteInfoToData(mf.Info())
}
return nil
}
func (action *saveImports) saveToInfo(mf *MachoFile) error {
// calculateHash := func(name string) uint32 {
// var h uint32 = 0x811c9dc5
// for _, s := range name {