<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=big5" http-equiv=Content-Type>
<META content="MSHTML 5.00.2919.6307" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi all,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>I am using uclinux-2.4.1+MIPS and compiler is gcc-2.96 
20000731.</FONT></DIV>
<DIV><FONT size=2>All the APs which written by C code are executed very well in 
my uclinux+MIPS.</FONT></DIV>
<DIV><FONT size=2>Howerer, the APs made by C++ are not so fine.</FONT></DIV>
<DIV><FONT size=2>The C++ problem is that the constructor of a global object 
will not be executed,</FONT></DIV>
<DIV><FONT size=2>but the constructor of a local object is executed 
normally.</FONT></DIV>
<DIV><FONT size=2>For example:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>#include <stdio.h></FONT></DIV>
<DIV><FONT size=2>class A{</FONT></DIV>
<DIV><FONT size=2>public:</FONT></DIV>
<DIV><FONT size=2>            A(int 
id) { printf("The constructor ID=%d!\n", id); };</FONT><FONT 
size=2></FONT></DIV>
<DIV><FONT size=2>};</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>A out(0);        
                // 
global </FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>int main()</FONT></DIV>
<DIV><FONT size=2>{</FONT></DIV>
<DIV><FONT size=2>    A 
in(1);                      
// local</FONT></DIV>
<DIV><FONT size=2>    return 0;</FONT></DIV>
<DIV><FONT size=2>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>The output is:</FONT></DIV>
<DIV><FONT size=2># The constructor ID=1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>Only the constructor of the local variable "in" was 
executed.</FONT></DIV>
<DIV><FONT size=2>Is it the problem of compiler or my uClibc or linker 
script??</FONT></DIV>
<DIV><FONT size=2>My elf2flt.ld is as following:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>ENTRY(_start)<BR>MEMORY 
{<BR>        flatmem : ORIGIN = 0x0, LENGTH = 
0x2000000<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>SECTIONS {<BR>        .text 
0 : 
{<BR>                
. = ALIGN(0x4) 
;<BR>                
_stext = . 
;<BR>                                
_start = . 
;<BR>                
*(.text)<BR>                
*(.text.*)<BR>                
*(.gnu.warning)<BR>                
*(.stub)<BR>                
*(.gnu.linkonce.t*)<BR>                
*(.init)<BR>                
. = ALIGN(0x10) 
;<BR>                
_etext = . ;<BR>        } > 
flatmem<BR>        .data : 
{<BR>                
. = ALIGN(0x4) 
;<BR>                
_sdata = . 
;<BR>                                
__data_start = . 
;<BR>                                
data_start = . 
;<BR>                                
/* Do not change _gp value 
*/<BR>                                
_gp = . + 
0x7ff0;<BR>                                
*(.rela.got)<BR>                                
*(.rel.got)<BR>                                
*(.got.plt)<BR>                                
*(.got)<BR>                                
LONG(-1)<BR>                
*(.rodata)<BR>                
*(.rodata.*)<BR>                
*(.gnu.linkonce.r*)<BR>                
*(.rodata1)<BR>                
*(.data)<BR>                
*(.data.*)<BR>                
*(.gnu.linkonce.d*)<BR>                
*(.data1)<BR>                
*(.eh_frame)<BR>                
*(.gcc_except_table)<BR>                
*(.sdata)<BR>                
*(.sdata.*)<BR>                
*(.gnu.linkonce.s.*)<BR>                                
. = ALIGN(4) 
;<BR>                                
*(.ctors.*)<BR>                                
*(.ctors)<BR>                                
LONG(0)<BR>                                
*(.dtors.*)<BR>                                
*(.dtors)<BR>                                
LONG(0)<BR>                
. = ALIGN(0x10) 
;<BR>                
_edata = . ;<BR>        } > 
flatmem<BR>        .lit8 : { *(.lit8) } 
>flatmem<BR>        .lit4 : { *(.lit4) } 
>flatmem<BR>        .bss : 
{<BR>                
. = ALIGN(0x4) 
;<BR>                
_sbss = ALIGN(0x4) 
;<BR>                                
__bss_start = . 
;<BR>                
*(.dynsbss)<BR>                
*(.sbss)<BR>                
*(.sbss.*)<BR>                
*(.scommon)<BR>                
*(.dynbss)<BR>                
*(.bss)<BR>                
*(.bss.*)<BR>                
*(COMMON)<BR>                
. = ALIGN(0x10) 
;<BR>                
_ebss = . 
;<BR>                                
_end = . 
;<BR>                                
end = . ;<BR>        } > 
flatmem<BR>        .reginfo : { *(.reginfo) } 
> flatmem<BR>        .rel.dyn : { 
*(.rel.dyn) } > flatmem<BR>}<BR></FONT></DIV>
<DIV><FONT size=2>Thanks very much for any of your hints!</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>KJ</DIV></FONT></BODY></HTML>