Page 1 of 1
OS Development With Mac OS X
Posted: Wed Jun 07, 2006 11:00 pm
by zachogden
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
Re: OS Development With Mac OS X
Posted: Wed Jun 07, 2006 11:00 pm
by osprogram
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.
Re: OS Development With Mac OS X
Posted: Wed Jun 07, 2006 11:00 pm
by zachogden
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
Re: OS Development With Mac OS X
Posted: Fri Jun 09, 2006 11:00 pm
by carbonBased
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
Re: OS Development With Mac OS X
Posted: Sat Jun 10, 2006 11:00 pm
by zachogden
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.