-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
JITbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software
Description
Description
The use of TLS in Mutex implementation on Linux seems to break LLVM's JIT linker?
let selfId = _swift_stdlib_gettid() |
Reproduction
import Synchronization
func takeMutex(_ m: borrowing Mutex<Int>) {
m.withLock { $0 = 0 }
}
And execute it in the immediate mode
$ swift check.swift
Stack dump
# On x86_64 Linux
JIT session error: In check-jitted-objectbuffer: Unsupported x86-64 relocation type R_X86_64_TLSLD
Failed to materialize symbols: { (main, { $s5check9takeMutexyy15Synchronization0C0VySiGF, $s15Synchronization5MutexVAARi_zrlE8withLockyqd__qd__xzYuqd_0_YKYTXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF6$deferL_yysAERd_0_Ri_zRi_d__r_0_lF, main }) }
# On aarch64 Linux
JIT session error: Symbols not found: [ __tlsdesc_resolver, __aarch64_cas4_acq, __aarch64_cas4_rel ]
Failed to materialize symbols: { (main, { main, $s4main9takeMutexyy15Synchronization0C0VySiGF, $s15Synchronization5MutexVAARi_zrlE8withLockyqd__qd__xzYuqd_0_YKYTXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF6$deferL_yysAERd_0_Ri_zRi_d__r_0_lF }) }
Expected behavior
Successfully link and execute
Environment
swift-DEVELOPMENT-SNAPSHOT-2025-09-23-a
Additional information
No response
omochi
Metadata
Metadata
Assignees
Labels
JITbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software