Skip to content

Commit

Permalink
fix: make crt-cmp position-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
gemesa committed Dec 20, 2024
1 parent f5f6c13 commit b2c58e5
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 @@ -118,7 +118,7 @@ $(BUILDDIR)/linux/x64/nocrt-args: lab/linux/asm-hive/x64/nocrt-args.s
ld $(BUILDDIR)/linux/x64/nocrt-args.o -g -o $@

$(BUILDDIR)/linux/x64/crt-cmp: lab/linux/asm-hive/x64/crt-cmp.s
gcc $< -g -o $@
gcc $< -fPIE -pie -g -o $@

$(BUILDDIR)/linux/x64/crt-loop: lab/linux/asm-hive/x64/crt-loop.s
gcc $< -g -o $@
Expand Down
4 changes: 2 additions & 2 deletions lab/linux/asm-hive/x64/crt-cmp.s
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ main_:
mov $1, %edi
mov $2, %esi
call min
mov $format_string, %edi
lea format_string(%rip), %rdi
mov %eax, %esi
call printf
xor %eax, %eax
Expand Down Expand Up @@ -42,7 +42,7 @@ main:
mov edi, 1
mov esi, 2
call min
mov edi, offset format_string
lea rdi, [rip + format_string]
mov esi, eax
call printf
xor eax, eax
Expand Down

0 comments on commit b2c58e5

Please sign in to comment.