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'm working on building & running the bare bones example via the cross compiler toolchain configured to target i586. I'm getting the following error and warning, and I'm kind of at the end of my rope on deducing what's going on! Any suggestions welcome.
Relevant output. Am I screwing up the GCC invocation?
Can guess that you're coding in C++? It looks like your kernel.o object has been compiled with exceptions enabled, but your linker script tells the linker to discard the exception table. Hence why it's warning you.
Find the command line option that the tutorial stated but is not present in your code. If necessary, look up its meaning in the compiler manual. It should be obvious from there.
PS: Regarding the issue JamesM pointed out, be notified that there is a separate C++ Bare Bones. (I didn't look beyond the first error out of habit.)
Every good solution is obvious once you've found it.
Wait a second... How does C++ come into the game? I know that .eh_frame smells like C++, but I really wonder where this comes from. All that I can see is a bit of assembly and pure C (gcc is called on a .c file - there is neither an invocation of g++, nor any .cpp here). And if the OP indeed followed the bare bones tutorial, there should be no C++ in his source files either. I'm surprised how ld comes up with a warning related to exception handling...
Find the command line option that the tutorial stated but is not present in your code. If necessary, look up its meaning in the compiler manual. It should be obvious from there.
PS: Regarding the issue JamesM pointed out, be notified that there is a separate C++ Bare Bones. (I didn't look beyond the first error out of habit.)
Thanks for the prompt reply guys. I was trying to get GCC to spit out one obj file, and then link that obj file with The obj produced by nasm via ld. What is standard practice for that? Multiple obj files?
XenOS wrote:Wait a second... How does C++ come into the game? I know that .eh_frame smells like C++, but I really wonder where this comes from. All that I can see is a bit of assembly and pure C (gcc is called on a .c file - there is neither an invocation of g++, nor any .cpp here). And if the OP indeed followed the bare bones tutorial, there should be no C++ in his source files either. I'm surprised how ld comes up with a warning related to exception handling...
"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 ]
You can get this error if your GCC is not built correctly. I'm not sure about the cross-compiler in the tutorial but for a long time I had this issue. Eventually modifying this line in my config.gcc solved it. My recollection is that it applies mainly to 64 bit cross-compilers. I'm not suggesting that it's your problem but offer it here in case others are looking for a solution.
When I've had this issue in the past (undefined symbol _start) I've managed to get around it with the gcc -freestanding flag. note, this is kind of unrelated to the eh_frame errors.
I'm confused after what I've read here. My cross-compiler has only C enabled, but it generates eh_frame sections anyway (discarded by linker). Is this wrong?
XenOS wrote:Wait a second... How does C++ come into the game? I know that .eh_frame smells like C++, but I really wonder where this comes from. All that I can see is a bit of assembly and pure C (gcc is called on a .c file - there is neither an invocation of g++, nor any .cpp here). And if the OP indeed followed the bare bones tutorial, there should be no C++ in his source files either. I'm surprised how ld comes up with a warning related to exception handling...
Interestingly, I thought the gcc compiler driver could compile .c files as C++ without -x c++ - I was wrong, apparently it requires -x c++.
I didn't notice the lack of "-c" on his command line, and that made me think gcc was compiling kernel.c as C++.