LD a.out format emulation?
- ThisMayWork
- Member
- Posts: 65
- Joined: Sat Mar 22, 2014 1:14 pm
- Location: /bin
LD a.out format emulation?
Since I started the development of my OS I have been using the cross compiler binaries for OSX provided in the wiki. Everything has been working correctly until today. I need to produce some user space objects in a.out format and apparently that version of ld does not support it. Is there any way to emulate it or do I have to rebuild the toolchain from scratch? If it is the latter, could somebody provide binaries? (I know, building it on my own is a very good learning experience but at the moment I am developing on a 64GB SSD and there isn't even enough space for the source code download )
"Programming is an art form that fights back."
-Kudzu
-Kudzu
Re: LD a.out format emulation?
Use other formats like elf.
- ThisMayWork
- Member
- Posts: 65
- Joined: Sat Mar 22, 2014 1:14 pm
- Location: /bin
Re: LD a.out format emulation?
a.out is easier to parse that is why I chose it. I have seen it's possible to do, that's why I am asking about it.
"Programming is an art form that fights back."
-Kudzu
-Kudzu
Re: LD a.out format emulation?
If you haven't got enough storage space left to build a cross-compiler then you are going to have a lot of problems. In your position I would buy an external drive and use that (at least to build the cross-compiler).
Re: LD a.out format emulation?
You can try to convert ELF files to a.out using objcopy. Even if your objcopy doesn't support a.out format, you can rebuild just the "binutils" package, not the whole toolchain.
- ThisMayWork
- Member
- Posts: 65
- Joined: Sat Mar 22, 2014 1:14 pm
- Location: /bin
Re: LD a.out format emulation?
Godsend! Thank you very muchNable wrote:You can try to convert ELF files to a.out using objcopy. Even if your objcopy doesn't support a.out format, you can rebuild just the "binutils" package, not the whole toolchain.
EDIT: I get "invalid bdf format" for both -O a.out and -O aout. Does this mean it is not supported?
"Programming is an art form that fights back."
-Kudzu
-Kudzu
Re: LD a.out format emulation?
No, this only means that you aren't eager enough to read the documentation (sorry, but "--help" parameter and manual pages really help in most cases). Just look at it:ThisMayWork wrote:EDIT: I get "invalid bdf format" for both -O a.out and -O aout. Does this mean it is not supported?
Code: Select all
$ objcopy --help
Usage: objcopy [option(s)] in-file [out-file]
Copies a binary file, possibly transforming it in the process
The options are:
[...]
objcopy: supported targets: elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 plugin srec symbolsrec verilog tekhex binary ihex
Report bugs to <http://www.sourceware.org/bugzilla/>
- ThisMayWork
- Member
- Posts: 65
- Joined: Sat Mar 22, 2014 1:14 pm
- Location: /bin
Re: LD a.out format emulation?
Sorry about that, instead of reading the manuals I googled and landed on an ancient hit. Still, it does not allow a.out What do I have to change in the binutils build process in order to get it to support a.out?
"Programming is an art form that fights back."
-Kudzu
-Kudzu
Re: LD a.out format emulation?
You should specify additional targets for libbfd.
In "bfd" sub-directory there's a separate "configure" that accepts this parameter:
I've never used it so I can't say exactly what to specify. But you can read build scripts from your favorite linux distro and look how additional formats are added there (in the previous post I've shown large list of supported targets from Debian's binutils).
In "bfd" sub-directory there's a separate "configure" that accepts this parameter:
Code: Select all
--enable-targets alternative target configurations