Skip to content

Commit

Permalink
fix: make crt-hello position-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
gemesa committed Dec 20, 2024
1 parent 5a188fc commit 0f444a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand Down
4 changes: 2 additions & 2 deletions lab/linux/asm-hive/x64/crt-hello.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ 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

.intel_syntax noprefix

main:
mov rdi, offset message
lea rdi, [rip + message]
call puts
xor eax, eax
ret

0 comments on commit 0f444a8

Please sign in to comment.