Hi all,
I'm beginning OS development on my new Intel iMac, and I've run into some issues with the included ld linker program. ld doesn't seem to want to link flat-binary files that I produce with NASM and/or GCC, which is a big problem. Does anyone know of a way around this, or where I could get an ld that will work for me?
Thanks,
Zach
OS Development With Mac OS X
Re: OS Development With Mac OS X
Linux Warning: There is a problem with ld on Linux. The problem is that the "ld" that comes with linux distros lists support for the coff object format, but apparently you have to rebuilt binutils from gnu.org to get it working. I found two possible solutions. Recompile ld or edit your assembly files and remove all the leading underscores. Then when you assemble with nasm use the -f aout option instead of coff. I've tested the second method briefly and it works.
I think the problem is the same for Mac OS as well.
I think the problem is the same for Mac OS as well.
Re: OS Development With Mac OS X
The problem isn't with coff files, it's the fact that just invoking ld with flat binaries gives me a message similar to the following:
Error: File is not a Mach-O binary or is missing Mach-O magic number
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: OS Development With Mac OS X
What if you produce a Mac OsX binary object, and use 'objcopy' to extract out the appropriate sections and concatenate them together with 'cat'
That way you can structure your binary however you'd like.
--Jeff
That way you can structure your binary however you'd like.
--Jeff
Re: OS Development With Mac OS X
I ended up making a cross-compile toolchain by configuring ld and gcc with --target=i686-elf . Everything works fine now, did a test this morning.