2012-03-28 9 views
0

これは私の問題です。 私は異なる地域で自分のコードを分割するリンカースクリプトを作成しました。 これはリンカスクリプトです:ldリンカースクリプトを使用してメモリがいっぱいになりません

OUTPUT_ARCH(arm) 

SECTIONS { 

. = 0x400000; 
.stack1 : { 
    __stack_start1 = . ; 
} 

. = 0x800000; 
.stack2 : { 
    __stack_start2 = . ; 
} 

. = 0x19900000; 
.vectors1 : { 
    *(.resetvector1) 
} 

. = 0x19900018; 
.irq_vector : { 
    *(.irqvector) 
} 

. = 0x19908000; 
.init : {   /* Init code and data */ 
    *(.text1.init) 
    *(.text2.init) 
} 

/DISCARD/ : {   /* Exit code and data */ 
    *(.text.exit) 
    *(.data.exit) 
    *(.exitcall.exit) 
} 

.text : {   /* Real text segment */ 
    _text = .;  /* Text and read-only data*/ 
     *(.text) 
    _etext = .;  /* End of text section */ 
} 

. = ALIGN(8192); 

.data : { 
    /* 
    * first, the init task union, aligned 
    * to an 8192 byte boundary. 
    */ 
    *(.init.task) 

    /* 
    * then the cacheline aligned data 
    */ 
    . = ALIGN(32); 
    *(.data.cacheline_aligned) 

    /* 
    * and the usual data section 
    */ 
    *(.data) 
    CONSTRUCTORS 

    _edata = .; 
} 

.bss : { 
    __bss_start = .; /* BSS */ 
    *(.bss) 
    *(COMMON) 
    _end = . ; 
} 

. = ALIGN(8192); 
_end_kernel = . ; 

.vectors2 : { 
     *(.resetvector2) 
} 

} 

それが正常に動作しますが、プログラム全体は数キロバイト程度であるとき、出力ファイルは450MB程度です! WHY ?? 私はldが私のスタック、データ、テキストなどの領域の間の空の領域を(0x0で)埋めていると思います。 この問題を回避するにはどうすればよいですか?

ありがとうございます。

答えて

1

の代わりにセクション名の場所の構文を使用してみます。 = location .section。これが助けにならない場合は、MEMORYで別のメモリ領域を定義し、セクションをそこに置くことで、この動作を確実に止めるべきです。

関連する問題