Created
April 28, 2019 06:22
-
-
Save fluffybeing/8ed1744a81c683c57054dfc197929ce7 to your computer and use it in GitHub Desktop.
ARM code for simple Swift Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func add(a: Int, b: Int) -> Int { | |
let sum = a + b | |
return sum | |
} | |
_ = add(a: 3, b: 6) | |
========= Assembly starts from here =================== | |
.section __TEXT,__text,regular,pure_instructions | |
.build_version macos, 10, 14 sdk_version 10, 14 | |
.globl _main | |
.p2align 4, 0x90 | |
_main: | |
pushq %rbp | |
movq %rsp, %rbp | |
xorl %eax, %eax | |
popq %rbp | |
retq | |
.private_extern _$s6result3add1a1bS2i_SitF | |
.globl _$s6result3add1a1bS2i_SitF | |
.p2align 4, 0x90 | |
_$s6result3add1a1bS2i_SitF: | |
pushq %rbp | |
movq %rsp, %rbp | |
addq %rsi, %rdi | |
jo LBB1_2 | |
movq %rdi, %rax | |
popq %rbp | |
retq | |
LBB1_2: | |
## InlineAsm Start | |
## InlineAsm End | |
ud2 | |
.private_extern __swift_FORCE_LOAD_$_swiftFoundation_$_result | |
.section __DATA,__const | |
.globl __swift_FORCE_LOAD_$_swiftFoundation_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftFoundation_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftFoundation_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftFoundation | |
.private_extern __swift_FORCE_LOAD_$_swiftDarwin_$_result | |
.globl __swift_FORCE_LOAD_$_swiftDarwin_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftDarwin_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftDarwin_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftDarwin | |
.private_extern __swift_FORCE_LOAD_$_swiftObjectiveC_$_result | |
.globl __swift_FORCE_LOAD_$_swiftObjectiveC_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftObjectiveC_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftObjectiveC_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftObjectiveC | |
.private_extern __swift_FORCE_LOAD_$_swiftCoreFoundation_$_result | |
.globl __swift_FORCE_LOAD_$_swiftCoreFoundation_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftCoreFoundation_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftCoreFoundation_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftCoreFoundation | |
.private_extern __swift_FORCE_LOAD_$_swiftDispatch_$_result | |
.globl __swift_FORCE_LOAD_$_swiftDispatch_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftDispatch_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftDispatch_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftDispatch | |
.private_extern __swift_FORCE_LOAD_$_swiftCoreGraphics_$_result | |
.globl __swift_FORCE_LOAD_$_swiftCoreGraphics_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftCoreGraphics_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftCoreGraphics_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftCoreGraphics | |
.private_extern __swift_FORCE_LOAD_$_swiftIOKit_$_result | |
.globl __swift_FORCE_LOAD_$_swiftIOKit_$_result | |
.weak_definition __swift_FORCE_LOAD_$_swiftIOKit_$_result | |
.p2align 3 | |
__swift_FORCE_LOAD_$_swiftIOKit_$_result: | |
.quad __swift_FORCE_LOAD_$_swiftIOKit | |
.private_extern ___swift_reflection_version | |
.section __TEXT,__const | |
.globl ___swift_reflection_version | |
.weak_definition ___swift_reflection_version | |
.p2align 1 | |
___swift_reflection_version: | |
.short 3 | |
.no_dead_strip ___swift_reflection_version | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftCoreFoundation_$_result | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftCoreGraphics_$_result | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftDarwin_$_result | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftDispatch_$_result | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftFoundation_$_result | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftIOKit_$_result | |
.no_dead_strip __swift_FORCE_LOAD_$_swiftObjectiveC_$_result | |
.linker_option "-lswiftFoundation" | |
.linker_option "-lswiftCore" | |
.linker_option "-lswiftDarwin" | |
.linker_option "-lswiftObjectiveC" | |
.linker_option "-lswiftCoreFoundation" | |
.linker_option "-framework", "CoreFoundation" | |
.linker_option "-lswiftDispatch" | |
.linker_option "-framework", "Foundation" | |
.linker_option "-framework", "ApplicationServices" | |
.linker_option "-framework", "ImageIO" | |
.linker_option "-lswiftCoreGraphics" | |
.linker_option "-framework", "CoreGraphics" | |
.linker_option "-lswiftIOKit" | |
.linker_option "-framework", "IOKit" | |
.linker_option "-framework", "CoreText" | |
.linker_option "-framework", "ColorSync" | |
.linker_option "-framework", "CoreServices" | |
.linker_option "-framework", "CFNetwork" | |
.linker_option "-framework", "Security" | |
.linker_option "-framework", "DiskArbitration" | |
.linker_option "-lobjc" | |
.section __DATA,__objc_imageinfo,regular,no_dead_strip | |
L_OBJC_IMAGE_INFO: | |
.long 0 | |
.long 83887936 | |
.subsections_via_symbols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment