Skip to content

runtime, WebAssembly: add ImageInspectionWasm.cpp #39483

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stdlib/public/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ set(swift_runtime_sources
ImageInspectionELF.cpp
ImageInspectionCOFF.cpp
ImageInspectionStatic.cpp
ImageInspectionWasm.cpp
KeyPaths.cpp
KnownMetadata.cpp
Metadata.cpp
Expand Down
35 changes: 35 additions & 0 deletions stdlib/public/runtime/ImageInspectionWasm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
///
/// \file
///
/// Implementation of ImageInspection for WebAssembly.
///
//===----------------------------------------------------------------------===//

#if defined(__wasm__)

#include "../SwiftShims/MetadataSections.h"
#include "ImageInspection.h"

using namespace swift;

int swift::lookupSymbol(const void *address, SymbolInfo *info) {
// Currently, Wasm doesn't have a standard stable ABI for exporting address <->
// symbol table, it's work in progress. Also, there is no API to access such
// information from Wasm binary side. It's accessible only from host VM.
// See https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md
// Seems reasonable to use a stub for now.
return 0;
}

#endif // defined(__wasm__)