program compiles and links fine, but _init() doesnt seem to do anything
top of main and entire linkfile listed below.
any help would be appreciated
thank,
mtm
Code: Select all
class testclass
{ public:
int testval;
testclass()
: testval( 300 )
{
}
int getval( void ) { return testval; }
};
testclass testinstance;
int main( int argc, char **argv )
{
MagCheckPoint( "Testval %d\n", testinstance.getval() ); // prints 0
gdb_stub_main( 0, 0 );
_init(); // call global / static constructors
MagCheckPoint( "Testval %d\n", testinstance.getval() ); // prints 0
... blah blah .....
}
Code: Select all
ENTRY(_start);
INPUT( /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/crtbegin.o )
INPUT( /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/crtend.o )
INPUT( /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/crti.o )
INPUT( /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/crtn.o )
SECTIONS
{
.init 0x00100000:
{ /* USE GCC's _init() */
*(.init)
}
.fini :
{ /* USE GCC's _init() */
*(.fini)
}
.text :
{ /* USE PS2LIBS's _start */
/usr/local/ps2dev/ps2lib/ee/startup/crt0.o(.text)
*(.text)
*(.text.*)
*(.gnu.linkonce.t*)
}
.ctors :
{
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{ KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.reginfo ALIGN(128): { KEEP(*(.reginfo)) }
/***************************************/
/* Static data. */
.rodata ALIGN(128): { *(.rodata) }
.data ALIGN(128):
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
}
.rdata ALIGN(128):
{
*(.rdata)
}
.rodata ALIGN(128):
{
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r*)
}
_gp = ALIGN(128) + 0x7ff0;
.lit4 ALIGN(128): { *(.lit4) }
.lit8 ALIGN(128): { *(.lit8) }
.sdata ALIGN(128):
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s*)
}
/***************************************/
/* Uninitialized data. */
.sbss ALIGN(128) (NOLOAD): {
_fbss = . ;
*(.scommon)
*(.sbss)
}
.bss ALIGN(128) (NOLOAD): { *(.bss) }
.COMMON ALIGN(128) (NOLOAD): { *(COMMON) }
_end_bss = .;
/***************************************/
_end = . ;
PROVIDE(end = .);
/***************************************/
/* Symbols needed by crt0.s. */
PROVIDE(_heap_size = -1);
PROVIDE(_stack = -1);
PROVIDE(_stack_size = 128 * 1024);
/***************************************/
}