@@ -33,6 +33,9 @@ using StaticInfixWitness = SWIFT_CC(swift) bool(OpaqueValue *, OpaqueValue *,
33
33
#elif defined(__MACH__)
34
34
#if defined(__aarch64__)
35
35
#define INDIRECT_RELREF_GOTPCREL (SYMBOL ) SYMBOL " @GOT - . + 1"
36
+ #elif defined(__arm__)
37
+ // Darwin doesn't support @GOT like syntax for 32 bit ARM.
38
+ #define INDIRECT_RELREF_GOTPCREL (SYMBOL ) " L" SYMBOL " $non_lazy_ptr - . + 1"
36
39
#else
37
40
#define INDIRECT_RELREF_GOTPCREL (SYMBOL ) SYMBOL " @GOTPCREL + 5"
38
41
#endif
@@ -42,6 +45,22 @@ using StaticInfixWitness = SWIFT_CC(swift) bool(OpaqueValue *, OpaqueValue *,
42
45
// Tuple Equatable Conformance
43
46
// ===----------------------------------------------------------------------===//
44
47
48
+ // For 32 bit ARM (specifically armv7 and armv7s for iphoneos), emit non-lazy
49
+ // pointer stubs to indirectly reference. Darwin doesn't support @GOT syntax for
50
+ // ARM.
51
+ #if defined(__MACH__) && defined(__arm__) && !defined(__aarch64__)
52
+ __asm (
53
+ " .section __DATA, __nl_symbol_ptr, non_lazy_symbol_pointers\n "
54
+ " .p2align 2\n "
55
+ " L" EQUATABLE_DESCRIPTOR_SYMBOL " $non_lazy_ptr:\n "
56
+ " .indirect_symbol " EQUATABLE_DESCRIPTOR_SYMBOL " \n "
57
+ " .long 0\n "
58
+ " L" EQUATABLE_EE_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
59
+ " .indirect_symbol " EQUATABLE_EE_METHOD_DESCRIPTOR " \n "
60
+ " .long 0\n "
61
+ );
62
+ #endif
63
+
45
64
// Define the conformance descriptor for tuple Equatable. We do this in
46
65
// assembly to work around relative reference issues.
47
66
__asm (
@@ -137,14 +156,42 @@ bool swift::_swift_tupleEquatable_equals(OpaqueValue *tuple1,
137
156
// Tuple Comparable Conformance
138
157
// ===----------------------------------------------------------------------===//
139
158
159
+ // For 32 bit ARM (specifically armv7 and armv7s for iphoneos), emit non-lazy
160
+ // pointer stubs to indirectly reference. Darwin doesn't support @GOT syntax for
161
+ // ARM.
162
+ #if defined(__MACH__) && defined(__arm__) && !defined(__aarch64__)
163
+ __asm (
164
+ " .section __DATA, __nl_symbol_ptr, non_lazy_symbol_pointers\n "
165
+ " .p2align 2\n "
166
+ " L" COMPARABLE_DESCRIPTOR_SYMBOL " $non_lazy_ptr:\n "
167
+ " .indirect_symbol " COMPARABLE_DESCRIPTOR_SYMBOL " \n "
168
+ " .long 0\n "
169
+ " L" COMPARABLE_BASE_CONFORMANCE_DESCRIPTOR " $non_lazy_ptr:\n "
170
+ " .indirect_symbol " COMPARABLE_BASE_CONFORMANCE_DESCRIPTOR " \n "
171
+ " .long 0\n "
172
+ " L" COMPARABLE_LT_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
173
+ " .indirect_symbol " COMPARABLE_LT_METHOD_DESCRIPTOR " \n "
174
+ " .long 0\n "
175
+ " L" COMPARBALE_LTE_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
176
+ " .indirect_symbol " COMPARBALE_LTE_METHOD_DESCRIPTOR " \n "
177
+ " .long 0\n "
178
+ " L" COMPARABLE_GTE_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
179
+ " .indirect_symbol " COMPARABLE_GTE_METHOD_DESCRIPTOR " \n "
180
+ " .long 0\n "
181
+ " L" COMPARABLE_GT_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
182
+ " .indirect_symbol " COMPARABLE_GT_METHOD_DESCRIPTOR " \n "
183
+ " .long 0\n "
184
+ );
185
+ #endif
186
+
140
187
// Define the associated conformance structure for tuple Comparable. We do this
141
188
// in assembly to work around relative reference issues.
142
189
__asm (
143
190
#if defined(__ELF__)
144
191
" .hidden \" " TUPLE_COMPARABLE_ASSOCIATEDCONFORMANCE " \"\n "
145
192
" .type \" " TUPLE_COMPARABLE_ASSOCIATEDCONFORMANCE " \" , @object\n "
146
- " .section swift5_typeref, \" a\" "
147
- " .weak \" " TUPLE_COMPARABLE_ASSOCIATEDCONFORMANCE " \" "
193
+ " .section swift5_typeref, \" a\"\n "
194
+ " .weak \" " TUPLE_COMPARABLE_ASSOCIATEDCONFORMANCE " \"\n "
148
195
#elif defined(__MACH__)
149
196
" .private_extern \" " TUPLE_COMPARABLE_ASSOCIATEDCONFORMANCE " \"\n "
150
197
" .section __TEXT, __swift5_typeref\n "
@@ -497,6 +544,31 @@ bool swift::_swift_tupleComparable_greaterThan(OpaqueValue *tuple1,
497
544
// Tuple Hashable Conformance
498
545
// ===----------------------------------------------------------------------===//
499
546
547
+ // For 32 bit ARM (specifically armv7 and armv7s for iphoneos), emit non-lazy
548
+ // pointer stubs to indirectly reference. Darwin doesn't support @GOT syntax for
549
+ // ARM.
550
+ #if defined(__MACH__) && defined(__arm__) && !defined(__aarch64__)
551
+ __asm (
552
+ " .section __DATA, __nl_symbol_ptr, non_lazy_symbol_pointers\n "
553
+ " .p2align 2\n "
554
+ " L" HASHABLE_DESCRIPTOR_SYMBOL " $non_lazy_ptr:\n "
555
+ " .indirect_symbol " HASHABLE_DESCRIPTOR_SYMBOL " \n "
556
+ " .long 0\n "
557
+ " L" HASHABLE_BASE_CONFORMANCE_DESCRIPTOR " $non_lazy_ptr:\n "
558
+ " .indirect_symbol " HASHABLE_BASE_CONFORMANCE_DESCRIPTOR " \n "
559
+ " .long 0\n "
560
+ " L" HASHABLE_HASHVALUE_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
561
+ " .indirect_symbol " HASHABLE_HASHVALUE_METHOD_DESCRIPTOR " \n "
562
+ " .long 0\n "
563
+ " L" HASHABLE_HASH_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
564
+ " .indirect_symbol " HASHABLE_HASH_METHOD_DESCRIPTOR " \n "
565
+ " .long 0\n "
566
+ " L" HASHABLE_RAWHASHVALUE_METHOD_DESCRIPTOR " $non_lazy_ptr:\n "
567
+ " .indirect_symbol " HASHABLE_RAWHASHVALUE_METHOD_DESCRIPTOR " \n "
568
+ " .long 0\n "
569
+ );
570
+ #endif
571
+
500
572
// Define the conformance descriptor for tuple Hashable. We do this in
501
573
// assembly to work around relative reference issues.
502
574
__asm (
@@ -570,22 +642,19 @@ __asm(
570
642
#endif
571
643
);
572
644
573
- // These are all function values that we reinterpret later.
574
- extern void *SWIFT_HASHVALUE_FUNC;
575
- extern void *SWIFT_HASHER_COMBINE_FUNC ;
645
+ extern " C " SWIFT_CC(swift)
646
+ intptr_t SWIFT_HASHVALUE_FUNC (OpaqueValue *value, Metadata *Self,
647
+ void *witnessTable) ;
576
648
577
- using HashValueFn = SWIFT_CC(swift) intptr_t (OpaqueValue *value, Metadata *Self,
578
- void *witnessTable);
579
- using HasherCombineFn = SWIFT_CC(swift) void (OpaqueValue *value,
580
- const Metadata *Self,
581
- const WitnessTable *witnessTable,
582
- SWIFT_CONTEXT OpaqueValue *hasher);
649
+ extern " C" SWIFT_CC(swift)
650
+ void SWIFT_HASHER_COMBINE_FUNC (OpaqueValue *value, const Metadata *Self,
651
+ const WitnessTable *witnessTable,
652
+ SWIFT_CONTEXT OpaqueValue *hasher);
583
653
584
654
SWIFT_RUNTIME_EXPORT SWIFT_CC (swift)
585
655
intptr_t _swift_tupleHashable_hashValue(SWIFT_CONTEXT OpaqueValue *tuple,
586
656
Metadata *Self, void *witnessTable) {
587
- auto _hashValue = reinterpret_cast <HashValueFn *>(&SWIFT_HASHVALUE_FUNC);
588
- return _hashValue (tuple, Self, witnessTable);
657
+ return SWIFT_HASHVALUE_FUNC (tuple, Self, witnessTable);
589
658
}
590
659
591
660
SWIFT_RUNTIME_EXPORT SWIFT_CC (swift)
@@ -606,11 +675,8 @@ void _swift_tupleHashable_hash(OpaqueValue *hasher,
606
675
auto value = reinterpret_cast <OpaqueValue *>(
607
676
reinterpret_cast <char *>(tuple) + elt.Offset );
608
677
609
- auto hasherCombine =
610
- reinterpret_cast <HasherCombineFn *>(&SWIFT_HASHER_COMBINE_FUNC);
611
-
612
678
// Call the combine function on the hasher for this element value and we're
613
679
// done!
614
- hasherCombine (value, elt.Type , conformance, hasher);
680
+ SWIFT_HASHER_COMBINE_FUNC (value, elt.Type , conformance, hasher);
615
681
}
616
682
}
0 commit comments