Last active
July 13, 2017 21:41
-
-
Save orivej/29b9834e4621f2c69bfddf0bfc1baa1f to your computer and use it in GitHub Desktop.
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
.intel_syntax | |
.globl _start | |
_start: | |
lea r12, __init_array_start | |
lea r13, __init_array_end | |
loop: | |
cmp r12, r13 | |
je end | |
call [r12] | |
add r12, 8 | |
jmp loop | |
end: | |
mov rdi, 0 | |
mov rax, 60 | |
syscall | |
ctor: | |
int3 | |
ret | |
.section .ctors | |
.quad ctor | |
.section .init_array, "aw", @init_array |
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
default: main.ld main.lld | |
clean: | |
rm -f lib.o main.o main.ld main.lld | |
main.ld: main.o | |
ld -o $@ $^ | |
main.lld: main.o | |
ld.lld -o $@ $^ | |
.s.o: | |
llvm-mc -filetype=obj -o $@ $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment