Skip to content

Commit 0a8f1f0

Browse files
authored
Merge pull request #64607 from mikeash/weak-dyld-lookup-section-info
[Runtime] Redeclare _dyld_lookup_section_info as weak.
2 parents 91810ee + a4c572f commit 0a8f1f0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stdlib/public/runtime/ImageInspectionMachO.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
#if __has_include(<objc/objc-internal.h>) && __has_include(<mach-o/dyld_priv.h>)
3434
#include <mach-o/dyld_priv.h>
3535
#include <objc/objc-internal.h>
36+
37+
// Redefine _dyld_lookup_section_info as weak so we can build against it but
38+
// still run when it's not present at runtime. Note that we don't have to check
39+
// for its presence at runtime, as it's guaranteed to be available if we get
40+
// the callbacks from objc_addLoadImageFunc2.
41+
LLVM_ATTRIBUTE_WEAK
42+
struct _dyld_section_info_result
43+
_dyld_lookup_section_info(const struct mach_header *mh,
44+
_dyld_section_location_info_t locationHandle,
45+
enum _dyld_section_location_kind kind);
3646
#else
3747

3848
// Bring our own definition of enum _dyld_section_location_kind and some of its

0 commit comments

Comments
 (0)