Notice
Recent Posts
Recent Comments
Link
목록Big Sur (1)
비트와 자장가
x86_64 어셈블리어 링킹linking
아래는 시스템콜 write를 호출해 "hello world"와 개행문자를 출력하는 간단한 C 프로그램이다: #include int main() { write(1, "hello world\n", 12); } gcc hello.c && ./a.out 위를 맥용 어셈블리어로 바꾸면 아래와 같다: globalstart section.text start: movrax, 0x02000004;write() movrdi, 1 movrsi, string movrdx, 12 syscall movrax, 0x02000001;exit() xorrdi, rdi syscall section.data string: db"hello world",10;"hello world\n" nasm -f macho64 hello.s && ld ..
개발/자료
2021. 3. 29. 20:45