summaryrefslogtreecommitdiff
path: root/PGU/CHAP8/helloworld-lib.s
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-07-10 22:55:07 +0200
committerCarlos Maiolino <[email protected]>2025-07-10 22:56:55 +0200
commitd98f46ce647846b0aa30b2e16a30fd4e152a1bf5 (patch)
tree267474fcc77cf20b428f6f4c7f768ca09f4cfe0e /PGU/CHAP8/helloworld-lib.s
parent869e68986aa8f69af6e7842260a68d1e5c6f796f (diff)
Add new code
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'PGU/CHAP8/helloworld-lib.s')
-rw-r--r--PGU/CHAP8/helloworld-lib.s20
1 files changed, 20 insertions, 0 deletions
diff --git a/PGU/CHAP8/helloworld-lib.s b/PGU/CHAP8/helloworld-lib.s
new file mode 100644
index 0000000..6e04968
--- /dev/null
+++ b/PGU/CHAP8/helloworld-lib.s
@@ -0,0 +1,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