Created
June 20, 2012 05:30
-
-
Save nlguillemot/2958276 to your computer and use it in GitHub Desktop.
label weirdness cross-compiled with linux arm gcc
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
.arch armv4t | |
.fpu softvfp | |
.eabi_attribute 20, 1 | |
.eabi_attribute 21, 1 | |
.eabi_attribute 23, 3 | |
.eabi_attribute 24, 1 | |
.eabi_attribute 25, 1 | |
.eabi_attribute 26, 2 | |
.eabi_attribute 30, 6 | |
.eabi_attribute 18, 4 | |
.file "tmp.c" | |
.section .rodata | |
.align 2 | |
.LC0: | |
.ascii "%d\012\000" | |
.text | |
.align 2 | |
.global justwait | |
.type justwait, %function | |
justwait: | |
@ Function supports interworking. | |
@ args = 0, pretend = 0, frame = 8 | |
@ frame_needed = 1, uses_anonymous_args = 0 | |
stmfd sp!, {fp, lr} | |
add fp, sp, #4 | |
sub sp, sp, #8 | |
str r0, [fp, #-8] | |
ldr r3, [fp, #-8] | |
cmp r3, #0 | |
beq .L2 | |
.L3: | |
ldr r3, .L6 | |
mov r0, r3 | |
mov r1, #4 | |
bl printf | |
mov r3, #0 | |
b .L4 | |
.L2: | |
ldr r3, .L6+4 | |
.L4: | |
mov r0, r3 | |
sub sp, fp, #4 | |
ldmfd sp!, {fp, lr} | |
bx lr | |
.L7: | |
.align 2 | |
.L6: | |
.word .LC0 | |
.word .L3 | |
.size justwait, .-justwait | |
.align 2 | |
.global print4 | |
.type print4, %function | |
print4: | |
@ Function supports interworking. | |
@ args = 0, pretend = 0, frame = 8 | |
@ frame_needed = 1, uses_anonymous_args = 0 | |
@ link register save eliminated. | |
str fp, [sp, #-4]! | |
add fp, sp, #0 | |
sub sp, sp, #12 | |
str r0, [fp, #-8] | |
ldr r3, [fp, #-8] | |
mov pc, r3 @ indirect register jump | |
.size print4, .-print4 | |
.align 2 | |
.global main | |
.type main, %function | |
main: | |
@ Function supports interworking. | |
@ args = 0, pretend = 0, frame = 8 | |
@ frame_needed = 1, uses_anonymous_args = 0 | |
stmfd sp!, {fp, lr} | |
add fp, sp, #4 | |
sub sp, sp, #8 | |
mov r0, #0 | |
bl justwait | |
mov r3, r0 | |
str r3, [fp, #-8] | |
ldr r0, [fp, #-8] | |
bl print4 | |
mov r3, #0 | |
mov r0, r3 | |
sub sp, fp, #4 | |
ldmfd sp!, {fp, lr} | |
bx lr | |
.size main, .-main | |
.ident "GCC: (ctng-1.6.1) 4.4.3" | |
.section .note.GNU-stack,"",%progbits |
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
#include <stdio.h> | |
typedef enum { false, true } bool; | |
void* justwait(bool selector) | |
{ | |
if (selector) | |
{ | |
DEARGOD: | |
printf("%d\n", 2+2); | |
return NULL; | |
} | |
else | |
{ | |
return &&DEARGOD; | |
} | |
} | |
void print4(void * WHYGODWHY) | |
{ | |
goto *WHYGODWHY; | |
} | |
int main() | |
{ | |
void * oops = justwait(false); | |
print4(oops); | |
return 0; | |
} |
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
.arch armv4t | |
.fpu softvfp | |
.eabi_attribute 20, 1 | |
.eabi_attribute 21, 1 | |
.eabi_attribute 23, 3 | |
.eabi_attribute 24, 1 | |
.eabi_attribute 25, 1 | |
.eabi_attribute 26, 2 | |
.eabi_attribute 30, 2 | |
.eabi_attribute 18, 4 | |
.file "tmp.c" | |
.text | |
.align 2 | |
.global print4 | |
.type print4, %function | |
print4: | |
@ Function supports interworking. | |
@ args = 0, pretend = 0, frame = 0 | |
@ frame_needed = 0, uses_anonymous_args = 0 | |
@ link register save eliminated. | |
mov pc, r0 @ indirect register jump | |
.size print4, .-print4 | |
.align 2 | |
.global justwait | |
.type justwait, %function | |
justwait: | |
@ Function supports interworking. | |
@ args = 0, pretend = 0, frame = 0 | |
@ frame_needed = 0, uses_anonymous_args = 0 | |
cmp r0, #0 | |
stmfd sp!, {r4, lr} | |
ldreq r0, .L9 | |
bne .L8 | |
.L5: | |
ldmfd sp!, {r4, lr} | |
bx lr | |
.L8: | |
.L4: | |
ldr r0, .L9+4 | |
mov r1, #4 | |
bl printf | |
mov r0, #0 | |
b .L5 | |
.L10: | |
.align 2 | |
.L9: | |
.word .L4 | |
.word .LC1 | |
.size justwait, .-justwait | |
.align 2 | |
.global main | |
.type main, %function | |
main: | |
@ Function supports interworking. | |
@ args = 0, pretend = 0, frame = 0 | |
@ frame_needed = 0, uses_anonymous_args = 0 | |
stmfd sp!, {r4, lr} | |
mov r0, #0 | |
bl justwait | |
mov r0, #0 | |
ldmfd sp!, {r4, lr} | |
bx lr | |
.size main, .-main | |
.section .rodata.str1.4,"aMS",%progbits,1 | |
.align 2 | |
.LC1: | |
.ascii "%d\012\000" | |
.ident "GCC: (ctng-1.6.1) 4.4.3" | |
.section .note.GNU-stack,"",%progbits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment