From 32209b171d14d67690d1734055dbda069fda34a5 Mon Sep 17 00:00:00 2001 From: Dan Pitic Date: Tue, 12 Jun 2018 21:44:44 +0800 Subject: [PATCH] Modified Listing 16-2 stack_unwind.asm to fix ld errors when linking with gcc. Required adding missing references to GOT and PLT. --- listings/chap16/stack_unwind/stack_unwind.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/listings/chap16/stack_unwind/stack_unwind.asm b/listings/chap16/stack_unwind/stack_unwind.asm index cb895e1..0450fd7 100755 --- a/listings/chap16/stack_unwind/stack_unwind.asm +++ b/listings/chap16/stack_unwind/stack_unwind.asm @@ -9,16 +9,16 @@ section .code unwind: push rbx -; while (rbx > fptr) { + ; while (rbx > fptr) { ; print rbx; rbx = [rbx]; ; } mov rbx, rbp .loop: - cmp rbx,fptr ; check if pointing fptr or lower + cmp rbx, [rel fptr wrt ..got] ; check if pointing fptr or lower jc .end mov rdi, format mov rsi, rbx - call printf + call printf wrt ..plt mov rbx, [rbx] jmp .loop