File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
stdlib/toolchain/Compatibility50 Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -86,18 +86,13 @@ using mach_header_platform = mach_header;
86
86
87
87
__attribute__ ((constructor))
88
88
static void installGetClassHook_untrusted() {
89
+ extern char __dso_handle[];
90
+
89
91
// swiftCompatibility* might be linked into multiple dynamic libraries because
90
92
// of build system reasons, but the copy in the main executable is the only
91
93
// one that should count. Bail early unless we're running out of the main
92
94
// executable.
93
- //
94
- // Newer versions of dyld add additional API that can determine this more
95
- // efficiently, but we have to support back to OS X 10.9/iOS 7, so dladdr
96
- // is the only API that reaches back that far.
97
- Dl_info dlinfo;
98
- if (dladdr ((const void *)(uintptr_t )installGetClassHook_untrusted, &dlinfo) == 0 )
99
- return ;
100
- auto machHeader = (const mach_header_platform *)dlinfo.dli_fbase ;
95
+ auto machHeader = (const mach_header_platform *)__dso_handle;
101
96
if (machHeader->filetype != MH_EXECUTE)
102
97
return ;
103
98
You can’t perform that action at this time.
0 commit comments