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

loader.elf seems to output as "executable" and ld refuses to link it #31

Open
robindegen opened this issue Apr 16, 2022 · 1 comment
Open
Assignees

Comments

@robindegen
Copy link

robindegen commented Apr 16, 2022

I'm not sure if this is just because of changes in the new versions, but i'm getting the following:

ld: cannot use executable file 'debug/elf/loader.elf' as input to a link

If I run file on it it says:

debug/elf/loader.elf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, with debug_info, not stripped
@robindegen
Copy link
Author

robindegen commented Apr 16, 2022

Looks like starting from ld version 2.36.1 you need to pass the -r flag to make it output a relocatable object.

- wsl ld -m elf_i386 -nostdlib -T ld/loader.ld debug/obj/*.o -o debug/elf/loader.elf
+ wsl ld -r -m elf_i386 -nostdlib -T ld/loader.ld debug/obj/*.o -o debug/elf/loader.elf

https://stackoverflow.com/questions/68622938/new-versions-of-ld-cannot-take-elf-files-as-input-to-link

@dhavalhirdhav dhavalhirdhav self-assigned this May 2, 2022
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

2 participants