mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Wasm][Runtime] Interpret absolute function pointer in runtime structures
When SWIFT_COMPACT_ABSOLUTE_FUNCTION_POINTER is enabled, relative direct pointers whose pointees are functions will be turned into absolute pointer at compile-time.
This commit is contained in:
@@ -76,7 +76,16 @@ static uintptr_t resolveSymbolicReferenceOffset(SymbolicReferenceKind kind,
|
||||
Directness isIndirect,
|
||||
int32_t offset,
|
||||
const void *base) {
|
||||
auto ptr = detail::applyRelativeOffset(base, offset);
|
||||
uintptr_t ptr;
|
||||
// Function references may be resolved differently than other data references.
|
||||
switch (kind) {
|
||||
case SymbolicReferenceKind::AccessorFunctionReference:
|
||||
ptr = (uintptr_t)TargetCompactFunctionPointer<InProcess, void>::resolve(base, offset);
|
||||
break;
|
||||
default:
|
||||
ptr = detail::applyRelativeOffset(base, offset);
|
||||
break;
|
||||
}
|
||||
|
||||
// Indirect references may be authenticated in a way appropriate for the
|
||||
// referent.
|
||||
@@ -2600,10 +2609,10 @@ void DynamicReplacementDescriptor::enableReplacement() const {
|
||||
|
||||
// Link the replacement entry.
|
||||
chainRoot->next = chainEntry.get();
|
||||
// chainRoot->implementationFunction = replacementFunction.get();
|
||||
// chainRoot->implementationFunction = getReplacementFunction();
|
||||
swift_ptrauth_init_code_or_data(
|
||||
reinterpret_cast<void **>(&chainRoot->implementationFunction),
|
||||
reinterpret_cast<void *>(replacementFunction.get()),
|
||||
reinterpret_cast<void *>(getReplacementFunction()),
|
||||
replacedFunctionKey->getExtraDiscriminator(),
|
||||
!replacedFunctionKey->isAsync());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user