kvm-hello-world icon indicating copy to clipboard operation
kvm-hello-world copied to clipboard

/usr/bin/ld: cannot use executable file 'payload.o' as input to a link

Open purplewall1206 opened this issue 3 years ago • 3 comments

Hi, when the makefile is executed to

 kvm-hello-world: kvm-hello-world.o payload.o
	$(CC) $^ -o $@

a error comes /usr/bin/ld: cannot use executable file 'payload.o' as input to a link

ld version is GNU ld (GNU Binutils) 2.36.1

Are there any good ideas to fix this? thanks.

purplewall1206 avatar Oct 30 '21 03:10 purplewall1206

hi, this problem has been fixed.

The main issue of the bad input is that payload.o has been linked into an executable file, which rejected by gcc-ld(version 2.36.1)

Add -r(output to be a relocatable file) in the payload.o generation solved the problem.

I will push a request later.

purplewall1206 avatar Oct 30 '21 09:10 purplewall1206

hi, just got common issue, i cannat no more inport sdio.h or any other library but how to implement that -r, tryied to add on gcc but doesent work, any help?

Lazarreg avatar Nov 06 '22 14:11 Lazarreg

hi, just got common issue, i cannat no more inport sdio.h or any other library but how to implement that -r, tryied to add on gcc but doesent work, any help?

like this :

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

maktiny avatar Mar 21 '23 06:03 maktiny