Skip to content

Commit 11b208a

Browse files
Merge pull request #4816 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents bf100d9 + 6c8d371 commit 11b208a

File tree

10 files changed

+39
-15
lines changed

10 files changed

+39
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
179179
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
180180
# can be reused when a new version of Swift comes out (assuming the user hasn't
181181
# manually set it as part of their own CMake configuration).
182-
set(SWIFT_VERSION "5.7")
182+
set(SWIFT_VERSION "5.7.1")
183183

184184
set(SWIFT_VENDOR "" CACHE STRING
185185
"The vendor name of the Swift compiler")

lib/Driver/UnixToolChains.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job,
184184
#else
185185
Arguments.push_back(context.Args.MakeArgString("-fuse-ld=" + Linker));
186186
#endif
187+
// Starting with lld 13, Swift stopped working with the lld --gc-sections
188+
// implementation for ELF, unless -z nostart-stop-gc is also passed to lld:
189+
//
190+
// https://reviews.llvm.org/D96914
191+
if (Linker == "lld" || (Linker.length() > 5 &&
192+
Linker.substr(Linker.length() - 6) == "ld.lld")) {
193+
Arguments.push_back("-Xlinker");
194+
Arguments.push_back("-z");
195+
Arguments.push_back("-Xlinker");
196+
Arguments.push_back("nostart-stop-gc");
197+
}
187198
}
188199

189200
// Configure the toolchain.

stdlib/public/core/UnsafeBufferPointer.swift.gyb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -742,19 +742,21 @@ extension Unsafe${Mutable}BufferPointer {
742742
return try body(.init(start: nil, count: 0))
743743
}
744744

745+
_debugPrecondition(
746+
Int(bitPattern: .init(base)) & (MemoryLayout<T>.alignment-1) == 0,
747+
"baseAddress must be a properly aligned pointer for types Element and T"
748+
)
749+
745750
let newCount: Int
746751
if MemoryLayout<T>.stride == MemoryLayout<Element>.stride {
747752
newCount = count
748-
_debugPrecondition(
749-
MemoryLayout<T>.alignment == MemoryLayout<Element>.alignment
750-
)
751753
} else {
752754
newCount = count * MemoryLayout<Element>.stride / MemoryLayout<T>.stride
753755
_debugPrecondition(
754-
Int(bitPattern: .init(base)) & (MemoryLayout<T>.alignment-1) == 0 &&
755756
MemoryLayout<T>.stride > MemoryLayout<Element>.stride
756757
? MemoryLayout<T>.stride % MemoryLayout<Element>.stride == 0
757-
: MemoryLayout<Element>.stride % MemoryLayout<T>.stride == 0
758+
: MemoryLayout<Element>.stride % MemoryLayout<T>.stride == 0,
759+
"Buffer must contain a whole number of Element instances"
758760
)
759761
}
760762
let binding = Builtin.bindMemory(base, newCount._builtinWordValue, T.self)

stdlib/public/core/UnsafePointer.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,10 @@ public struct UnsafePointer<Pointee>: _Pointer {
319319
( MemoryLayout<Pointee>.stride > MemoryLayout<T>.stride
320320
? MemoryLayout<Pointee>.stride % MemoryLayout<T>.stride == 0
321321
: MemoryLayout<T>.stride % MemoryLayout<Pointee>.stride == 0
322-
)))
322+
)
323+
),
324+
"self must be a properly aligned pointer for types Pointee and T"
325+
)
323326
let binding = Builtin.bindMemory(_rawValue, count._builtinWordValue, T.self)
324327
defer { Builtin.rebindMemory(_rawValue, binding) }
325328
return try body(.init(_rawValue))
@@ -1026,7 +1029,10 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
10261029
( MemoryLayout<Pointee>.stride > MemoryLayout<T>.stride
10271030
? MemoryLayout<Pointee>.stride % MemoryLayout<T>.stride == 0
10281031
: MemoryLayout<T>.stride % MemoryLayout<Pointee>.stride == 0
1029-
)))
1032+
)
1033+
),
1034+
"self must be a properly aligned pointer for types Pointee and T"
1035+
)
10301036
let binding = Builtin.bindMemory(_rawValue, count._builtinWordValue, T.self)
10311037
defer { Builtin.rebindMemory(_rawValue, binding) }
10321038
return try body(.init(_rawValue))

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ extension Unsafe${Mutable}RawBufferPointer {
866866
return try body(.init(start: nil, count: 0))
867867
}
868868
_debugPrecondition(
869-
Int(bitPattern: s) & (MemoryLayout<T>.alignment-1) == 0
869+
Int(bitPattern: s) & (MemoryLayout<T>.alignment-1) == 0,
870+
"baseAddress must be a properly aligned pointer for type T"
870871
)
871872
// initializer ensures _end is nil only when _position is nil.
872873
_internalInvariant(_end != nil)

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ public struct UnsafeRawPointer: _Pointer {
378378
_ body: (_ pointer: UnsafePointer<T>) throws -> Result
379379
) rethrows -> Result {
380380
_debugPrecondition(
381-
Int(bitPattern: self) & (MemoryLayout<T>.alignment-1) == 0
381+
Int(bitPattern: self) & (MemoryLayout<T>.alignment-1) == 0,
382+
"self must be a properly aligned pointer for type T"
382383
)
383384
let binding = Builtin.bindMemory(_rawValue, count._builtinWordValue, T.self)
384385
defer { Builtin.rebindMemory(_rawValue, binding) }
@@ -934,7 +935,8 @@ public struct UnsafeMutableRawPointer: _Pointer {
934935
_ body: (_ pointer: UnsafeMutablePointer<T>) throws -> Result
935936
) rethrows -> Result {
936937
_debugPrecondition(
937-
Int(bitPattern: self) & (MemoryLayout<T>.alignment-1) == 0
938+
Int(bitPattern: self) & (MemoryLayout<T>.alignment-1) == 0,
939+
"self must be a properly aligned pointer for type T"
938940
)
939941
let binding = Builtin.bindMemory(_rawValue, count._builtinWordValue, T.self)
940942
defer { Builtin.rebindMemory(_rawValue, binding) }

test/Driver/link-time-opt.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// CHECK-SIMPLE-THIN-linux-gnu: clang
1717
// CHECK-SIMPLE-THIN-linux-gnu-DAG: -flto=thin
1818
// CHECK-SIMPLE-THIN-linux-gnu-DAG: -fuse-ld=lld
19+
// CHECK-SIMPLE-THIN-linux-gnu-DAG: -Xlinker -z -Xlinker nostart-stop-gc
1920
// CHECK-SIMPLE-THIN-linux-gnu-DAG: [[BITCODEFILE]]
2021
// CHECK-SIMPLE-THIN-linux-gnu-NOT: swift-autolink-extract
2122

@@ -37,6 +38,7 @@
3738
// CHECK-SIMPLE-FULL-linux-gnu: clang
3839
// CHECK-SIMPLE-FULL-linux-gnu-DAG: -flto=full
3940
// CHECK-SIMPLE-FULL-linux-gnu-DAG: -fuse-ld=lld
41+
// CHECK-SIMPLE-FULL-linux-gnu-DAG: -Xlinker -z -Xlinker nostart-stop-gc
4042
// CHECK-SIMPLE-FULL-linux-gnu-DAG: [[BITCODEFILE]]
4143
// CHECK-SIMPLE-FULL-linux-gnu-NOT: swift-autolink-extract
4244

test/Serialization/Recovery/types-5-to-4.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import Lib
1616
func requiresConformance(_: B_RequiresConformance<B_ConformsToProto>) {}
1717
func requiresConformance(_: B_RequiresConformance<C_RelyOnConformanceImpl.Assoc>) {}
1818

19-
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 5.7) because it has overridable members that could not be loaded in Swift 4.1.50}}
20-
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 5.7) because it has requirements that could not be loaded in Swift 4.1.50}}
19+
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 5.7.1) because it has overridable members that could not be loaded in Swift 4.1.50}}
20+
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 5.7.1) because it has requirements that could not be loaded in Swift 4.1.50}}
2121

2222
#else // TEST
2323

test/SourceKit/Misc/compiler_version.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
// CHECK: key.version_major: 5
44
// CHECK: key.version_minor: 7
5-
// CHECK: key.version_patch: 0
5+
// CHECK: key.version_patch: 1

utils/build_swift/build_swift/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
CMAKE_GENERATOR = 'Ninja'
4747

4848
COMPILER_VENDOR = 'none'
49-
SWIFT_USER_VISIBLE_VERSION = Version('5.7')
49+
SWIFT_USER_VISIBLE_VERSION = Version('5.7.1')
5050
CLANG_USER_VISIBLE_VERSION = Version('13.0.0')
5151
SWIFT_ANALYZE_CODE_COVERAGE = 'false'
5252

0 commit comments

Comments
 (0)