Skip to content

Commit 63e42a4

Browse files
authored
Switch to __TEXT segment (#71639)
The data emitted by `DebugDescriptionMacro` is constant. For that reason, it was placed in `__DATA_CONST`. However, this causes a problem with the linker, which emits an error if the `__DATA_CONST` segment is _not_ marked `SG_READ_ONLY`. After discussion, it was pointed out that if the constant data has no fixups, then it can and should be in the the `__TEXT` segment. The `__DATA_CONST` segment is for data that is essentially constant but contains dyld fixups.
1 parent 1ecd938 commit 63e42a4

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

lib/Macros/Sources/SwiftMacros/DebugDescriptionMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ extension _DebugDescriptionPropertyMacro: PeerMacro {
218218
#elseif os(Windows)
219219
@_section(".lldbsummaries")
220220
#else
221-
@_section("__DATA_CONST,__lldbsummaries")
221+
@_section("__TEXT,__lldbsummaries")
222222
#endif
223223
@_used
224224
static let _lldb_summary = (

test/Macros/DebugDescription/extension.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ struct MyStruct {}
1010
extension MyStruct {
1111
var debugDescription: String { "thirty" }
1212
}
13-
// CHECK: #if os(Linux)
14-
// CHECK: @_section(".lldbsummaries")
15-
// CHECK: #elseif os(Windows)
16-
// CHECK: @_section(".lldbsummaries")
17-
// CHECK: #else
18-
// CHECK: @_section("__DATA_CONST,__lldbsummaries")
19-
// CHECK: #endif
20-
// CHECK: @_used
2113
// CHECK: static let _lldb_summary = (
2214
// CHECK: /* version */ 1 as UInt8,
2315
// CHECK: /* record size */ 34 as UInt8,

test/Macros/DebugDescription/linkage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct MyStruct: CustomDebugStringConvertible {
1313
// CHECK: #elseif os(Windows)
1414
// CHECK: @_section(".lldbsummaries")
1515
// CHECK: #else
16-
// CHECK: @_section("__DATA_CONST,__lldbsummaries")
16+
// CHECK: @_section("__TEXT,__lldbsummaries")
1717
// CHECK: #endif
1818
// CHECK: @_used
1919
// CHECK: static let _lldb_summary = (

0 commit comments

Comments
 (0)