Tiny 128 byte ARM ELF Hello World
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
$ xxd hello_world_128 | |
0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000 .ELF............ | |
0000010: 0200 2800 0100 0000 5480 0000 3400 0000 ..(.....T...4... | |
0000020: b800 0000 0202 0005 3400 2000 0100 2800 ........4. ...(. | |
0000030: 0400 0300 0100 0000 0000 0000 0080 0000 ................ | |
0000040: 0080 0000 8000 0000 8000 0000 0500 0000 ................ | |
0000050: 0080 0000 0100 8fe2 10ff 2fe1 0120 0349 ........../.. .I | |
0000060: 0e22 0427 00df 0127 00df 0000 7080 0000 .".'...'....p... | |
0000070: 4865 6c6c 6f2c 2077 6f72 6c64 0a00 c046 Hello, world...F |
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
#! /bin/sh | |
as -mthumb -R -o shell.o -k shell.s && ld -o shell shell.o && objdump -d shell && strip shell |
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
.data | |
hello_world: | |
.asciz "Hello, world\n" | |
len_hi = . - hello_world | |
.section .text | |
.global _start | |
_start: | |
//Switch to thumb for smaller code | |
.code 32 | |
add r0, pc, #1 | |
bx r0 | |
.code 16 | |
//write(1,&hello_world,strlen(hello_world)); | |
mov r0, #1 | |
ldr r1, =hello_world | |
ldr r2, =len_hi | |
mov r7, #4 | |
svc #0 | |
//exit(0) | |
mov r7, #1 | |
svc #0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment