diff --git a/Makefile b/Makefile index 2ce0b7d..c0bc01c 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ $(BUILDDIR)/linux/arm64x/shcode_shell: arsenal/linux/arm64/shcode_shell.s llvm-objcopy -O binary --only-section=.text $@ $(BUILDDIR)/linux/arm64x/shcode_shell.bin $(BUILDDIR)/linux/x64/crt-hello: lab/linux/asm-hive/x64/crt-hello.s - gcc $< -g -o $@ + gcc $< -fPIE -pie -g -o $@ $(BUILDDIR)/linux/x64/crt-stack: lab/linux/asm-hive/x64/crt-stack.s gcc $< -g -o $@ diff --git a/lab/linux/asm-hive/x64/crt-hello.s b/lab/linux/asm-hive/x64/crt-hello.s index e2d3619..0a15f73 100644 --- a/lab/linux/asm-hive/x64/crt-hello.s +++ b/lab/linux/asm-hive/x64/crt-hello.s @@ -10,7 +10,7 @@ message: .asciz "Hello\n" main_: - mov $message, %rdi # arg0 - const char *string + lea message(%rip), %rdi # arg0 - const char *string call puts xor %eax, %eax # set return value to 0 ret @@ -18,7 +18,7 @@ main_: .intel_syntax noprefix main: - mov rdi, offset message + lea rdi, [rip + message] call puts xor eax, eax ret