diff --git a/Makefile b/Makefile index c0bc01c..f354e07 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ $(BUILDDIR)/linux/x64/crt-hello: lab/linux/asm-hive/x64/crt-hello.s gcc $< -fPIE -pie -g -o $@ $(BUILDDIR)/linux/x64/crt-stack: lab/linux/asm-hive/x64/crt-stack.s - gcc $< -g -o $@ + gcc $< -fPIE -pie -g -o $@ $(BUILDDIR)/linux/x64/nocrt-hello: lab/linux/asm-hive/x64/nocrt-hello.s as $< -g -o $(BUILDDIR)/linux/x64/nocrt-hello.o diff --git a/lab/linux/asm-hive/x64/crt-stack.s b/lab/linux/asm-hive/x64/crt-stack.s index c64e6dd..53a5c16 100644 --- a/lab/linux/asm-hive/x64/crt-stack.s +++ b/lab/linux/asm-hive/x64/crt-stack.s @@ -60,20 +60,20 @@ main_: mov $10, %edi mov $11, %esi call sum - mov $format_string, %edi + lea format_string(%rip), %rdi mov %eax, %esi call printf mov $10, %edi mov $11, %esi call mul - mov $format_string, %edi + lea format_string(%rip), %rdi mov %eax, %esi call printf xor %eax, %eax mov $10, %edi mov $11, %esi call calc - mov $format_string, %edi + lea format_string(%rip), %rdi mov %eax, %esi call printf pop %rbp @@ -132,20 +132,20 @@ main: mov edi, 10 mov esi, 11 call sum - mov edi, offset format_string + lea rdi, [rip + format_string] mov esi, eax call printf mov edi, 10 mov esi, 11 call mul - mov edi, offset format_string + lea rdi, [rip + format_string] mov esi, eax call printf xor eax, eax mov edi, 10 mov esi, 11 call calc - mov edi, offset format_string + lea rdi, [rip + format_string] mov esi, eax call printf pop rbp