Hello World in ARM Assembly without data section
arm, assembly, c, shellcode
Solution
ARM already has PC-relative addressing, and in any case, `bl` does not push the return address on the stack.
This works:
.global _start
_start:
mov r7, #4
mov r0, #1
adr r1, string
mov r2, #12
swi 0
mov r7, #1
swi 0
string:
.ascii "Hello, World"
Problem
I have a "Hello, World!" program in ARM assembly language and I want to convert it into shell code to execute it in a memory region. In Intel Assembly language I got rid of the .data section since only the .text section is being used when converting to shell code. (See here) Now I am struggling to do the same in ARMs assembly language. The basis is the following code: ARM Assembly Hello World ``` .global _start _start: mov r7, #4 mov r0, #1 ldr r1,=string mov r2, #12 swi 0 mov r7, #1 swi 0 .data string: .ascii "Hello, World" ``` Modified ARM Assembly Hello World to omit the .data section ``` .global _start .global mymessage mymessage: mov r7, #4 mov r0, #1 pop {r1} mov r2, #12 swi 0 mov r7, #1 swi 0 _start: bl mymessage .ascii "Hello, World" ``` But this doesn't work, since this is an "illegal instruction" apparently. Any ideas?