Skip to content

Instantly share code, notes, and snippets.

@expipiplus1
Created October 15, 2016 12:10
Show Gist options
  • Save expipiplus1/25ca07108478a30bf6b5c28f3c8549c3 to your computer and use it in GitHub Desktop.
Save expipiplus1/25ca07108478a30bf6b5c28f3c8549c3 to your computer and use it in GitHub Desktop.
I have a function `main` compiled from C with `-mthumb`.
This is the entry point to the program
```asm
.TEXT
.GLOBAL _start
_start:
.ALIGN
.CODE 32
b _header_end
.fill 188, 1, 0
_header_end:
mov r0, #0
ldr lr, =_header_end
ldr r5, =main
add r5,r5,#1
bx r5
.END
```
I'm adding one to `r5` in order for the `bx` instruction to switch to thumb mode. But this doesn't work. Interestingly this code still works when I compile without `-mthumb`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment