{"id":18823,"date":"2017-09-05T16:11:42","date_gmt":"2017-09-05T20:11:42","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=18823"},"modified":"2025-07-08T21:53:23","modified_gmt":"2025-07-09T01:53:23","slug":"injecting-missing-methods-at-runtime","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2017\/09\/05\/injecting-missing-methods-at-runtime\/","title":{"rendered":"Injecting Missing Methods at Runtime"},"content":{"rendered":"<p><a href=\"https:\/\/www.hopperapp.com\/blog\/?p=219\">Vincent B&eacute;nony<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.hopperapp.com\/blog\/?p=219\"><p>The important thing here is that most of the methods you&rsquo;ll use are lazily bound. It means that instead of resolving the address of every method at loading time, the linker will write the address of a resolution method, and the effective resolution will be made the first time the method is used.<\/p><p>[&#8230;]<\/p><p>So, if a symbol is missing, how about resolving it by ourselves?<\/p><p>This is simpler than it sounds, and here is how we&rsquo;ll proceed: we&rsquo;ll parse the Mach-O header of the library, find where the lazy binding information is stored, find the symbol table, and replace the pointer in the __la_symbols_ptr section with our replacement code.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Vincent B&eacute;nony: The important thing here is that most of the methods you&rsquo;ll use are lazily bound. It means that instead of resolving the address of every method at loading time, the linker will write the address of a resolution method, and the effective resolution will be made the first time the method is used.[&#8230;]So, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-07-09T01:53:24Z","apple_news_api_id":"d6d7e8a2-24ce-4dcf-b080-d332e66739de","apple_news_api_modified_at":"2025-07-09T01:53:24Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A1tfooiTOTc-wgNMy5mc53g","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[770,45,205,763,30,2792,1381,71,901],"class_list":["post-18823","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-assembly-language","tag-c","tag-dyld","tag-hopper","tag-mac","tag-mach-o","tag-macos-10-12","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/18823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=18823"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/18823\/revisions"}],"predecessor-version":[{"id":18824,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/18823\/revisions\/18824"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=18823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=18823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=18823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}