summaryrefslogtreecommitdiff
path: root/PGU/CHAP8/helloworld-lib.s
blob: 6e04968bfe07e33b0270cce83788a2de407ec150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Hello world using DSOs

.section .data
	helloworld:
		.ascii "hello world\n\0"

.section .text

.globl _start

_start:

	# This differs from the book. In x86_64, arguments are passed through
	# registers most of the time, in contrast with i386, where we can push
	# them in the stack.
	movq $helloworld, %rdi
	call printf

	movq $50, %rdi
	call exit