Commit Graph

7 Commits

Author SHA1 Message Date
Jordan Rose
b5176939ca [test] Tweak some tests so that they run consistently on OS X 10.9 2018-10-03 16:54:38 -07:00
Arnold Schwaighofer
6eca97add6 Codesign test/Interpreter 2018-08-10 06:58:40 -07:00
Jordan Rose
2947fd5ff6 [test] Tweak class_getImageName to correctly handle 2018 OS betas
I messed up the condition here---'targetEnvironment(device)' is
ignored and should be written '!targetEnvironment(simulator)'---but
even besides that I didn't actually have the right conditions for
which iOS devices this passes on and which it doesn't. Rather than
trying to perfectly match this with an XFAIL, just skip the parts of
the test that depend on having a new enough 2018 OS build if we, well,
don't have it.

rdar://problem/42398849
2018-07-19 15:18:44 -07:00
Jordan Rose
a2c1aa3624 [runtime] Backwards-deployment support for class_getImageName
Follow-up to 3ed3774e07. On Apple OSs that don't have the new
Objective-C runtime function 'objc_setHook_getImageName', override the
system definition of 'class_getImageName' by literally rewriting
symbol tables at run time.

Yes, you read that correctly.

The low-level part of this patch was written by Greg Parker, then
simplified and tweaked by me to fit the Swift coding style. Don't try
this at home; it comes with all sorts of caveats and won't actually
work on this year's iOS. (Fortunately we don't need it there, because
that will have the new ObjC entry point.)

The rest of the patch is pretty straightforward: the replacement
implementation calls the code that supports Swift objects (the same
code we use on newer OSs), which then chains back to the original
system implementation of class_getImageName. May we never have to
touch this again.

rdar://problem/41535552
2018-07-18 18:28:12 -07:00
Jordan Rose
ee760d8c56 [test] Fix the install_name for class_getImageName.swift tests (#17946)
Important when %target-run is not going to run the executable from its
current location.

rdar://problem/42184572
2018-07-13 19:14:56 -07:00
Jordan Rose
978849228f [test] Fix class_getImageName.swift on 32-bit iOS simulator (#17943)
The deallocation order is important in these tests, so we need to take
autorelease pools out of the equation.

rdar://problem/42178988
2018-07-13 16:33:56 -07:00
Jordan Rose
3ed3774e07 Override ObjC's class_getImageName to handle Swift classes
This not only restores the correct behavior for classes with generic
ancestry, but also handles actual generic classes as well. (This is
the function that backs Foundation's Bundle.init(for: AnyClass)
initializer.)

https://bugs.swift.org/browse/SR-1917
rdar://problem/33450609&40367300
2018-07-12 15:48:58 -07:00