Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the compile failed '/usr/bin/ld: cannot use executable file 'payload.o' as input to a link' #16

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Next Next commit
fix bad input
  • Loading branch information
purplewall1206 committed Oct 30, 2021
commit 45685f5528c3619396aee8cdb4aabd339ea19814
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS = -Wall -Wextra -Werror -O2
CFLAGS = -Wall -Wextra -Werror -O2 -shared

.PHONY: run
run: kvm-hello-world
Expand All @@ -11,7 +11,7 @@ kvm-hello-world: kvm-hello-world.o payload.o
$(CC) $^ -o $@

payload.o: payload.ld guest16.o guest32.img.o guest64.img.o
$(LD) -T $< -o $@
$(LD) -r -T $< -o $@

guest64.o: guest.c
$(CC) $(CFLAGS) -m64 -ffreestanding -fno-pic -c -o $@ $^
Expand Down