Skip to content

Commit 08549c7

Browse files
[WASM] Separate SwiftRT from ELF
1 parent 1b3daf9 commit 08549c7

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

stdlib/public/runtime/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ endif(LLVM_ENABLE_ASSERTIONS)
7979
set(LLVM_OPTIONAL_SOURCES
8080
SwiftRT-COFF.cpp
8181
SwiftRT-ELF.cpp
82+
SwiftRT-WASM.cpp
8283
${swift_runtime_sources}
8384
${swift_runtime_objc_sources}
8485
${swift_runtime_leaks_sources})

stdlib/public/runtime/SwiftRT-ELF.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,9 @@ static swift::MetadataSections sections{};
4646

4747
__attribute__((__constructor__))
4848
static void swift_image_constructor() {
49-
#ifndef __wasm__
5049
#define SWIFT_SECTION_RANGE(name) \
5150
{ reinterpret_cast<uintptr_t>(&__start_##name), \
5251
static_cast<uintptr_t>(&__stop_##name - &__start_##name) }
53-
#else
54-
// WebAssembly hack: ok this should really go in its own file
55-
#define SWIFT_SECTION_RANGE(name) \
56-
{ reinterpret_cast<uintptr_t>(&__start_##name) + sizeof(void*), \
57-
static_cast<uintptr_t>(&__stop_##name - &__start_##name - sizeof(void*)) }
58-
#endif
5952

6053
sections = {
6154
swift::CurrentSectionMetadataVersion,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//===--- SwiftRT-WASM.cpp --------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)