Commit Graph

3 Commits

Author SHA1 Message Date
Mike Ash
bdb822a788 [Runtime] Accept Nil in the patched bundleForClass:.
The patched +[NSBundle bundleForClass:] crashes on Nil, while the original Foundation implementation returns the main bundle. Avoid the crash and pass Nil through to Foundation. This also ensures that Nil is passed through to class_getImageName rather than crashing.

SR-9188 rdar://problem/45849924
2018-11-15 17:19:12 -05:00
Jordan Rose
6930a0f25a [runtime] Directly reference objc_setHook_getImageName (#19414)
(instead of using dlsym)

The original use went in before <objc/runtime.h> was updated, but now
it should be present in all Xcode 10 SDKs.

rdar://problem/42137765
2018-09-20 18:13:14 -07:00
Mike Ash
e704dd0353 [Runtime][Foundation] Supplement the class_getImageName patch with a patch to +[NSBundle bundleForClass:] on older "embedded" targets. The patch technique of editing the symbol table doesn't work for +bundleForClass:'s call to class_getImageName when +bundleForClass: is in an embedded shared cache.
rdar://problem/44489216
2018-09-19 13:29:10 -04:00