Skip to content

libdispatch compiled without frame pointers in at least in Swift 6.2, 6.1 and 6.0 on x86_64 #909

@weissi

Description

@weissi

It appears that Swift on Linux is still compiling without frame pointers in 6.0, 6.1 and 6.2. The official docker images for for example Ubuntu 24.04 (noble) on x86_64 have this code:

Expected:
has pushq %rbp; movq %rsp, %rbp

Actual:
hasn't got push rbp; mov rsp,rbp

One-line repro from nothing: docker run -it --rm --platform linux/amd64 swift:6.2-noble lldb --batch -o 'dis -n _dispatch_sema4_wait' /usr/lib/swift/linux/libdispatch.so

(lldb) target create "/usr/lib/swift/linux/libdispatch.so" Current executable set to '/usr/lib/swift/linux/libdispatch.so' (x86_64). (lldb) dis -n _dispatch_sema4_wait libdispatch.so`_dispatch_sema4_wait: libdispatch.so[0x3c580] <+0>: pushq %rbx libdispatch.so[0x3c581] <+1>: movq %rdi, %rbx libdispatch.so[0x3c584] <+4>: nopw %cs:(%rax,%rax) libdispatch.so[0x3c590] <+16>: movq %rbx, %rdi libdispatch.so[0x3c593] <+19>: callq 0x1f410 ; symbol stub for: sem_wait libdispatch.so[0x3c598] <+24>: cmpl $-0x1, %eax libdispatch.so[0x3c59b] <+27>: jne 0x3c5ac ; <+44> libdispatch.so[0x3c59d] <+29>: callq 0x1ee20 ; symbol stub for: __errno_location libdispatch.so[0x3c5a2] <+34>: cmpl $0x4, (%rax) libdispatch.so[0x3c5a5] <+37>: je 0x3c590 ; <+16> libdispatch.so[0x3c5a7] <+39>: callq 0x22c70 ; _dispatch_sema4_wait.cold.1 libdispatch.so[0x3c5ac] <+44>: popq %rbx libdispatch.so[0x3c5ad] <+45>: retq 

Same for the Swift overlay :(

No rbp pushing

(lldb) dis -n 'Dispatch.DispatchSemaphore.wait' libswiftDispatch.so`wait: libswiftDispatch.so[0x19120] <+0>: jmp 0x190b0 ; Dispatch.DispatchSemaphore.wait(wallTimeout: Dispatch.DispatchWallTime) -> Dispatch.DispatchTimeoutResult libswiftDispatch.so`wait: libswiftDispatch.so[0x190b0] <+0>: pushq %rax libswiftDispatch.so[0x190b1] <+1>: movq %rdi, %rsi libswiftDispatch.so[0x190b4] <+4>: movq 0x10(%r13), %rdi libswiftDispatch.so[0x190b8] <+8>: callq 0x14ca0 ; symbol stub for: dispatch_semaphore_wait libswiftDispatch.so[0x190bd] <+13>: testq %rax, %rax libswiftDispatch.so[0x190c0] <+16>: setne %al libswiftDispatch.so[0x190c3] <+19>: popq %rcx libswiftDispatch.so[0x190c4] <+20>: retq libswiftDispatch.so`wait: libswiftDispatch.so[0x190a0] <+0>: movq 0x10(%r13), %rdi libswiftDispatch.so[0x190a4] <+4>: movq $-0x1, %rsi libswiftDispatch.so[0x190ab] <+11>: jmp 0x14ca0 ; symbol stub for: dispatch_semaphore_wait 

running the one-line repro:

$ docker run -it --rm --platform linux/amd64 swift:6.2-noble lldb --batch -o 'dis -n _dispatch_sema4_wait' /usr/lib/swift/linux/libdispatch.so lldb[1]: ==== LLDB swift-healthcheck log. === This file contains the configuration of LLDB's embedded Swift compiler to help diagnosing module import and search path issues. The swift-healthcheck command is meant to be run *after* an error has occurred. lldb version 17.0.0 (https://github.com/swiftlang/llvm-project.git revision f403f1080b28ed3bf592ccbc491dadda2a5d4814) Swift version 6.2 (swift-6.2-RELEASE) (lldb) target create "/usr/lib/swift/linux/libdispatch.so" Current executable set to '/usr/lib/swift/linux/libdispatch.so' (x86_64). (lldb) dis -n _dispatch_sema4_wait libdispatch.so`_dispatch_sema4_wait: libdispatch.so[0x3c580] <+0>: pushq %rbx libdispatch.so[0x3c581] <+1>: movq %rdi, %rbx libdispatch.so[0x3c584] <+4>: nopw %cs:(%rax,%rax) libdispatch.so[0x3c590] <+16>: movq %rbx, %rdi libdispatch.so[0x3c593] <+19>: callq 0x1f410 ; symbol stub for: sem_wait libdispatch.so[0x3c598] <+24>: cmpl $-0x1, %eax libdispatch.so[0x3c59b] <+27>: jne 0x3c5ac ; <+44> libdispatch.so[0x3c59d] <+29>: callq 0x1ee20 ; symbol stub for: __errno_location libdispatch.so[0x3c5a2] <+34>: cmpl $0x4, (%rax) libdispatch.so[0x3c5a5] <+37>: je 0x3c590 ; <+16> libdispatch.so[0x3c5a7] <+39>: callq 0x22c70 ; _dispatch_sema4_wait.cold.1 libdispatch.so[0x3c5ac] <+44>: popq %rbx libdispatch.so[0x3c5ad] <+45>: retq 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions