Skip to content

Instantly share code, notes, and snippets.

@rinsuki
Created September 21, 2024 08:38
Show Gist options
  • Save rinsuki/9355f36b6af05720cb0030c266458c4c to your computer and use it in GitHub Desktop.
Save rinsuki/9355f36b6af05720cb0030c266458c4c to your computer and use it in GitHub Desktop.
swiftc -emit-assembly -Osize -target arm64-apple-macos14 test.swift
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 13, 0 sdk_version 15, 0
.globl _main
.p2align 2
_main:
mov w0, #0
ret
.private_extern _$s4test4mainSiyF
.globl _$s4test4mainSiyF
.p2align 2
_$s4test4mainSiyF:
.cfi_startproc
stp x29, x30, [sp, #-16]!
mov x29, sp
.cfi_def_cfa w29, 16
.cfi_offset w30, -8
.cfi_offset w29, -16
mov w0, #14
mov x1, #0
mov x2, #0
bl _$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF
tst w0, #0x1
mov w8, #1
cinc x0, x8, ne
ldp x29, x30, [sp], #16
ret
.cfi_endproc
.section __TEXT,__swift5_entry,regular,no_dead_strip
.p2align 2, 0x0
l_entry_point:
.long _main-l_entry_point
.long 0
.private_extern ___swift_reflection_version
.section __TEXT,__const
.globl ___swift_reflection_version
.weak_definition ___swift_reflection_version
.p2align 1, 0x0
___swift_reflection_version:
.short 3
.no_dead_strip l_entry_point
.no_dead_strip ___swift_reflection_version
.no_dead_strip _main
.linker_option "-lswift_Concurrency"
.linker_option "-lswiftCore"
.linker_option "-lswift_StringProcessing"
.linker_option "-lobjc"
.linker_option "-lswiftCompatibilityPacks"
.section __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
.long 0
.long 100665152
.subsections_via_symbols
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 14, 0 sdk_version 15, 0
.globl _main
.p2align 2
_main:
mov w0, #0
ret
.private_extern _$s4test4mainSiyF
.globl _$s4test4mainSiyF
.p2align 2
_$s4test4mainSiyF:
mov w0, #2
ret
.section __TEXT,__swift5_entry,regular,no_dead_strip
.p2align 2, 0x0
l_entry_point:
.long _main-l_entry_point
.long 0
.private_extern ___swift_reflection_version
.section __TEXT,__const
.globl ___swift_reflection_version
.weak_definition ___swift_reflection_version
.p2align 1, 0x0
___swift_reflection_version:
.short 3
.no_dead_strip l_entry_point
.no_dead_strip ___swift_reflection_version
.no_dead_strip _main
.linker_option "-lswift_Concurrency"
.linker_option "-lswiftCore"
.linker_option "-lswift_StringProcessing"
.linker_option "-lobjc"
.section __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
.long 0
.long 100665152
.subsections_via_symbols
func main() -> Int {
if #available(macOS 14, *) {
return 2
}
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment