Page 3 of 4
Re:Providing C++ Runtime support for Kernel
Posted: Sun Nov 10, 2002 9:41 pm
by PlayOS
I guess I should advise of the second error, silly me ::), In your class definition you have unsigned short *vidmem, but in your class implementation you are using videomem.
I havent finished reading yet, but good stuff anyway.
Re:Providing C++ Runtime support for Kernel
Posted: Sun Nov 10, 2002 9:49 pm
by PlayOS
I am getting a parse error from LD:
F:\MINGW\BIN\LD.EXE:link.ld:2: parse error
As I am yet to learn how these scripts work, I cannot compile, so I will wait for your solution, thanks.
I am also getting an undefined reference to __builtin_delete when I try to use LD directly, I am using the -fno-builtin switch so I dont know what is happening, I use the mingw version of the GCC tools.
thanks.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 3:45 am
by whyme_t
Thanks for pointing out my silly errors
I've fixed all, except the vidmem, I'll do that later.
As to the parse error, If it's part 2, I'm wondering if it's because you might have put __CTOR_END__ on a new line?
__CTOR__LIST__ should be on one line, ending with __CTOR_END__, it's just the html wraps arround.
Tell me if this fixes the parse error.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 4:46 am
by PlayOS
Sorry, I should have specified where the problem was better, it is in part 1, I have copied the linker script straight from the site, I have no idea about these scripts so I dont know if there are any errors in it or not.
Do you know why I am getting the error about __builtin_delete, I also get an undefined reference error about __main.
Thanks.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 6:27 am
by whyme_t
ok. I've fixed the mistake in both Video.h and Link.ld
PlayOS : Do you still get these undefined references with the updated Link.ld ?
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 6:44 am
by PlayOS
No, the error has changed to this
F:\MINGW\BIN\LD.EXE: PE operations on non PE file.
Any ideas?
thanks.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 6:50 am
by whyme_t
try adding
Code: Select all
/*****************************************************************************
for MinGW32
*****************************************************************************/
#ifdef __WIN32__
int __main(void) { return 0; }
#endif
/*****************************************************************************
*****************************************************************************/
This is taken straight from the OSD source code. It must be there for a reason!
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 7:11 am
by PlayOS
Unfortuantely I still get the error about a PE operation on a non PE file.
I am no longer getting the error about undefined references when I use the linker script, I just get the above error.
I was getting this error before when using C, and it was suggested to me to compile to an executable file and then use objcopy to convert to a flat binary, this worked for that, but I dont know how to get an executable file using a liner script, also my when I use -f aout in my nasm command line I get an error from LD (I think) that goes like this:
Loader.o: file not recognized: File format not recognized
I dont what is going on, maybe it is my compiler and linker.
Sorry for being such a headache.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 7:29 am
by whyme_t
to change to formet change the line
putting the format you need.
"binary", "coff-go32", "elf32-i386", "pei-i386", "pe-i386"
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 7:43 am
by PlayOS
And the saga continues.....
Now the undefined references are back :
kernel.o(.text+0x23):kernel.cpp: undefined reference to `__main'
video.o(.text+0x39):video.cpp: undefined reference to `__builtin_delete'
I was looking in my docs for my GCC and it does not mention new and delete being affected by the
-fno-builtin it only mentions these ones
abort, abs, alloca, cos, exit, fabs, ffs, labs, memcmp, memcpy, sin, sqrt, strcmp, strcpy, strlen
So maybe it is the distribution of GCC that I have, I think that I have DJGPP somewhere on disk I might try installing and using it.
thanks again.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 7:49 am
by whyme_t
If you can't find how to disable __builtin functions, try defining them in your code. (strange, it can't find delete, but it doesn't mention new!)
The undefined reference to __main, might well be the reason the OSD code had that __main function above.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 7:53 am
by whyme_t
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 8:05 am
by PlayOS
Nope, still getting the same errors, stupid thing! >:(
I am putting this my kernel.cpp file
/****************************************
for MinGW32
****************************************/
#ifdef __WIN32__
int __main(void) { return 0; }
#endif
void inline __builtin_delete(void* arg){}; // from the FAQ
/***************************************/
However no luck, the errors dont change at all.
This stuff is going to drive me insane..
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 8:09 am
by whyme_t
???
er...hmm...
try compiling it in a C file (not a CPP file), and then link it with LD.
I noticed in the faq, it mentions compiling with the switch -r , not sure what that does.
Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 9:04 am
by PlayOS
For anyone who reads this, DONT USE MINGW32 for a C++ kernel!!!!
I have installed Djgpp and everything went perfect, no problems at all.
Cant wait to continue on with these tutorials, and thanks for all your help.