Commit Graph

19 Commits

Author SHA1 Message Date
Mike Ash
e1fff8127e [Test] Gate newer objc_getClass tests on OS version.
The last two tests in the NotPresent test check for fixes that went into 5.3. Testing these against earlier runtimes will fail. Add availability checks so we only test when the fix is present.

While we're here, switch the symbolic references test to use indirect references. Direct references are very likely to pass the test even without the fix, as the reference is likely to point to readable memory. Indirect references make this much more likely to crash by then reading and dereferencing a pointer from the memory the relative pointer points to.

rdar://159034772
2025-08-27 11:53:06 -04:00
Mike Ash
614f4becef [Runtime] Reject suffixes on ObjC mangled class names.
The demangler tolerates arbitrary suffixes on mangled names, and parses them as a Suffix node. When looking up a class by an ObjC mangled name, we don't want such demanglings to succeed, because this will result in false positives. It's expected that NSClassFromString(someClassName + "some suffix") will fail, unless something has actually created a class with that suffix.

rdar://problem/60012296
2020-03-04 12:05:35 -05:00
Joe Groff
427ed9c79d Compatibility50: Fix for high-bit characters. 2019-09-06 18:19:19 -04:00
Joe Groff
a49e0d5a2e Runtime: Hook the ObjC runtime with an untrusted demangler.
We don't want objc_getClass and NSClassFromString to be able to feed arbitrary symbolic reference
pointers into the Swift runtime. Fixes rdar://problem/54724618.
2019-08-28 11:56:45 -07:00
Stephen Canon
ca1e808bde Replace all 9999 availability in non-stdlib tests. (#26109)
Replace all 9999 availability in non-stdlib tests with the appropriate platform availability.
2019-07-12 14:48:37 -04:00
Slava Pestov
e1e0984cc7 Revert "Frontend: Remove -enable-resilience flag"
This reverts commit 566e9dfea0.
2019-06-24 14:33:45 -04:00
Slava Pestov
566e9dfea0 Frontend: Remove -enable-resilience flag 2019-06-22 21:37:04 -04:00
Mike Ash
6746911dde [Test] Add availability to the GenericMangled test in objc_getClass.swift
This is a new test in Swift 5.1 that is not expected to pass when running
with the Swift 5.0 runtime library.

rdar://problem/50175915
2019-05-21 10:26:02 -04:00
Bob Wilson
dbde6aa65e [Test] Add availability to the ResilientNSObject test in objc_getClass.swift
This is a new test in Swift 5.1 that is not expected to pass when running
with the Swift 5.0 runtime library.

rdar://problem/50175915
2019-05-16 09:43:53 -07:00
Slava Pestov
7c8641c497 Fix formatting nit in objc_getClass test 2019-04-19 17:39:51 -04:00
Harlan Haskins
e8d474aa11 Merge pull request #23343 from harlanhaskins/mangled-lassi
[Demangle] Check for old-style mangling in getObjCClassByMangledName
2019-03-17 22:24:34 -07:00
Harlan Haskins
09bdaa35c5 [test] Test looking up resilient NSObject subclasses
Add tests to make sure we can look up resilient NSObject subclasses in the ObjC runtime.
2019-03-17 17:29:36 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Slava Pestov
b64db715a8 IRGen: Remove -enable-class-resilience staging flag 2019-02-08 14:22:00 -05:00
Saleem Abdulrasool
d77801abaf test: define and use %target-rpath
Create a new capturing substitution for adding a rpath to a target
library.  This is needed as Windows doesn't really support the concept
of a rpath.  This also makes it possible to remove the parameter from
the command line on windows.
2018-12-12 19:51:08 -08:00
Saleem Abdulrasool
ed1ec54958 test: make %target-library-name work in captures
Thanks to @jrose for the hint about the substitution ordering, the new
substitution now works even inside the capture group.  Replace the
remaining uses to the new macro.
2018-12-12 10:09:58 -08:00
Saleem Abdulrasool
8968fcad5f test: create and use target-library-name 2018-12-12 08:37:59 -08:00
Saleem Abdulrasool
b212229db1 test: add and use prefix substitutions for libraries
The naming convention is different on Windows than on Unix-like
environments.  In order to follow the convention we need to substitute
the prefix and the suffix.  Take the opportunity to rename the
`target-dylib-extension` to the CMake-like variable
`target-shared-library-suffix` and introduce
`target-shared-library-prefix`.  This helps linking the test suite
binaries on Windows.
2018-12-11 15:56:06 -08:00
Greg Parker
70bbeaab78 [runtime] Register a hook for class name lookup from libobjc (#20650)
libobjc needs to look up classes by name. Some Swift classes, such as
instantiated generics and their subclasses, are created only on demand.
Now a by-name lookup from libobjc counts as a demand for those classes.

rdar://problem/27808571
2018-11-29 17:06:28 -08:00