I'm using the g++ that came with RH linux 8.
I had wrote my runtime support for constructors.
My Problem is with the Desctructors.
I can't add the Destructor for the Global Object classes.
If i put a destructor. I get some error in linking.
" undefined symbols. __dso_handle and __cxa_atexit "
__dso_handle is in data section.
__cxa_atexit may be a function.
I found this after doing some search in the "libc" with "objdump"
when I dump my kernel i cant found any .dtors section.
I just defined a variable and a dummy function as
extern "C" {
void *__dso_handle;
void __cxa_atexit() {
}
}
Now my linker is cheated by me.
BUT BUT BUT. HOW can I handle it properly.
When and how my destructors can be called without a .dtors section.
help me please...
thank you.
g++ kernel
Re:g++ kernel
__cxa_atexit hints at an error in your compiler flags. I'd daresay you forgot to add -ffreestanding, --no-startup or a similar necessary option. (Can't test ATM which one results in said error message when omitted.)
__cxa_atexit is a runtime support function, which should not be linked into your binary at all since in kernel space you have to runtime support save your own.
Just a very humble IMHO in the earliest morning and without having tested this...
PS: Erm... which "libc" did you objdump? I'm smelling something here. You are aware you mustn't just link the RH libc into your kernel image, are you?
__cxa_atexit is a runtime support function, which should not be linked into your binary at all since in kernel space you have to runtime support save your own.
Just a very humble IMHO in the earliest morning and without having tested this...
PS: Erm... which "libc" did you objdump? I'm smelling something here. You are aware you mustn't just link the RH libc into your kernel image, are you?
Every good solution is obvious once you've found it.
Re:g++ kernel
for a guess, -fno-cxa-atexit or something similar. Man gcc.Solar wrote: __cxa_atexit hints at an error in your compiler flags. I'd daresay you forgot to add -ffreestanding, --no-startup or a similar necessary option. (Can't test ATM which one results in said error message when omitted.)
__cxa_atexit is a runtime support function, which should not be linked into your binary at all since in kernel space you have to runtime support save your own.