My C++ kernel, like almost any C++ program, includes some constructors, which are put int the .ctors section and must be run before operation. When compiling the source file where the constructors are stored, the .ctors section is present in the object file and includes a valid address : everything is fine.
Code: Select all
Contents of section .ctors:
0000 00000000 00000000 ........
Code: Select all
ENTRY(kinit)
PHDRS {
headers PT_PHDR PHDRS;
rx PT_LOAD FLAGS(5);
r PT_LOAD FLAGS(4);
rw PT_LOAD FLAGS(6);
}
SECTIONS {
. = 0x1001000; /* Loaded at 16MB+4KB in order to prevent erasing GRUB-provided modules */
.text ALIGN(4096) :
{
*(.text*)
*(.gnu.linkonce.t*)
} : rx
.rodata ALIGN(4096) :
{
start_ctors = .;
*(.ctor*)
end_ctors = .;
start_dtors = .;
*(.dtor*)
end_dtors = .;
*(.rodata*)
*(.gnu.linkonce.r*)
} : r
.data ALIGN(4096) :
{
*(.data*)
*(.gnu.linkonce.d*)
} : rw
.bss ALIGN(4096) :
{
*(.COMMON*)
*(.bss*)
*(.gnu.linkonce.b*)
} : rw
/DISCARD/ :
{
*(.comment)
*(.eh_frame) /* We're not implementing runtime support for C++ exceptions. */
}
}
When I look at said symbols, their value sounds fine :
Code: Select all
0000000001002000 g .rodata 0000000000000000 start_ctors
0000000001002008 g .rodata 0000000000000000 end_ctors
Code: Select all
Contents of section .rodata:
1002000 2c130001 00000000 00800b00 00000000 ,...............
1002010 0e .
Can someone help me understand what went wrong there ?