Difference between SDK (closed) and SDK (open)
Both of these "compile". One works, on 1.1.3 and one fails...
take yer pick, the trick here is not the underlying ASM, but rather the gcc.dylib that one links into and the underlying kernel when the code is executed on the iphone natively:
Source:
root@srv:~$ cat hello.c
#include <stdio.h>
int main() {printf("Hello!\n");}
APPLE SDK - currently fails on 1.1.{3,4}
imac /~/ cat hello.s
.cstring
.align 2
LC0:
.ascii "Hello!\0"
.text
.align 2
.globl _main
_main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
stmfd sp!, {r7, lr}
add r7, sp, #0
ldr r3, L5
L2:
add r3, pc, r3
mov r0, r3
bl L_puts$stub
mov r3, #0
mov r0, r3
ldmfd sp!, {r7, pc}
.p2align 2
L6:
.align 2
L5:
.long LC0-(L2+8)
.section __TEXT,__picsymbolstub4,symbol_stubs,none,16
.align 2
L_puts$stub:
.indirect_symbol _puts
ldr ip, L_puts$slp
L1$scv: add ip, pc, ip
ldr pc, [ip, #0]
L_puts$slp:
.long L_puts$lazy_ptr - (L1$scv + 8)
.lazy_symbol_pointer
L_puts$lazy_ptr:
.indirect_symbol _puts
.long dyld_stub_binding_helper
.constructor
.destructor
.align 1
.subsections_via_symbols
OPEN SDK - currently works on 1.1.{3,4}
root@srv:~$ cat hello.s
.text
.globl _main
.align 2
_main:
sub sp, sp, #8
str lr, [sp, #+4]
str r7, [sp]
mov r7, sp
sub sp, sp, #4
ldr r3, LCPI1_0
LPC1:
add r0, pc, r3
bl L_puts$stub
LBB1_1: @ return
ldr r0, [r7, #-4]
mov sp, r7
ldr r7, [sp]
ldr lr, [sp, #+4]
add sp, sp, #8
bx lr
LBB1_2:
LCPI1_0:
.long _.str-(LPC1+8)
.cstring
_.str: @ .str
.asciz "Hello!"
.section __TEXT,__picsymbolstub4,symbol_stubs,none,16
.align 2
.code 32
L_puts$stub:
.indirect_symbol _puts
ldr ip, L_puts$slp
L_puts$scv:
add ip, pc, ip
ldr pc, [ip, #0]
L_puts$slp:
.long L_puts$lazy_ptr-(L_puts$scv+8)
.lazy_symbol_pointer
L_puts$lazy_ptr:
.indirect_symbol _puts
.long dyld_stub_binding_helper
.subsections_via_symbols
