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

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

Open
purplewall1206 opened this issue Oct 30, 2021 · 3 comments

Comments

@purplewall1206
Copy link

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
Copy link
Author

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.

@Lazarreg
Copy link

Lazarreg commented Nov 6, 2022

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?

@maktiny
Copy link

maktiny commented Mar 21, 2023

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  $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants