Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I was looking thru old topics and I saw that some people managed to fix the mac os x linker to work with flat binary files but I didn't see anyone post a step by step on how they did this. I've been googling for a couple of hours for the answer to this problem but I found nothing so any help would be greatly appreciated.
In the past I have been able to overcome this problem by emulating fedora and using its linker. (Which is a pain as it wastes my computers resources and causes me to lag a lot)
the error the mac os x linker gives me is:
ld: Pass 1
link.ld
ld: link.ld bad magic number (not a Mach-O file)
test.o
kernel.o
ld: kernel.o bad magic number (not a Mach-O file)
I tried rebuilding bin utils but that I get a couple errors
Colonel Kernel wrote:Build a GCC cross-compiler. The wiki has a tutorial. That's what I did on Mac OS X, and it worked great.
but my compiler works fine the problem is with the linker complaining is not a mach-o file.. wouldn't this just reinstall gcc ? or does it also include the linker ?
Which cross-compiler article did you mean ? I see 3 on the wiki
If you read the tutorial, all will be explained. Everyone runs into this problem (although the error message is different on other platforms), and the solution suggested is always the same.
To get you started, I will clarify a bit: The tutorial covers building all the tools you'll need for compiling and linking your kernel -- so yes, ld is included. Also, here is the link:
I could send you binaries, but I think building your own cross-compiler is a better long-term solution. You'll learn more about how the GNU toolchain works and how to use it, plus you'll be one step ahead when the day finally comes to make your OS self-hosted.
To put it more bluntly, it's a rite of passage. So get busy.
Top three reasons why my OS project died:
Too much overtime at work
Got married
My brain got stuck in an infinite loop while trying to design the memory manager
Colonel Kernel wrote:If you read the tutorial, all will be explained. Everyone runs into this problem (although the error message is different on other platforms), and the solution suggested is always the same.
To get you started, I will clarify a bit: The tutorial covers building all the tools you'll need for compiling and linking your kernel -- so yes, ld is included. Also, here is the link:
I could send you binaries, but I think building your own cross-compiler is a better long-term solution. You'll learn more about how the GNU toolchain works and how to use it, plus you'll be one step ahead when the day finally comes to make your OS self-hosted.
To put it more bluntly, it's a rite of passage. So get busy.
haha iight
If I fail to compile these I'll get back to you =]
You can not use binary files as input to a linker. The linker will have no clue as what to link as binary files do not contain any such information. You'll need to assemble to an object format. For the cross-compiler, that's ELF.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Combuster wrote:You can not use binary files as input to a linker. The linker will have no clue as what to link as binary files do not contain any such information. You'll need to assemble to an object format. For the cross-compiler, that's ELF.
well now it works with nasm after I specified elf output format for it but gcc still fails to compile..
wiki wrote:This, in combination with lots of other assembly-level error messages (like, Warning: .type pseudo-op used outside of .def/.endef ignored, or Error: unknown pseudo-op: '.local') results when you did not correctly set the --prefix=$PREFIX during the binutils configure.
I don't own a mac so if Colonel Kernel (or somebody else who has one) could test-build the cross-compiler according to the wiki instructions, we know wether it should work or not. Since I do know is that those instructions work on both linux (gentoo) and cygwin, I think you missed something. Still, a check would be welcome.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]