2014年10月26日 星期日

linker script 說明

Linker Script (LD Script) 的目的是提供Linker針對編譯後的Object檔案做位置安排的設定

VMA = Virtual Memory Address
LMA = Load Memory Address

.text = program code
.rodara  = read-only data
.data = read-write initialized data
.bss = read-write uninitialized data


SECTIONS
{
    . = 0x10000; /* 設定記憶體位址(VMA or LMA?)為0x10000 */
    .text : { *(.text) } /* 將所有輸入文件的.text section 合併成一個 .text section */
    . = 0x8000000; /* 設定記憶體位址(VMA or LMA?)為0x8000000 */
    .data : { *(.data) } /* 將所有輸入文件的.data section 合併成一個 .data section */
    .bss : { *(.bss) } /* 將所有輸入文件的.bss section 合併成一個 .bss section */
}

說明:
'.'  : 原文為"location counter",代表目前擺放的位址。


Reference:
http://www.scoberlin.de/content/media/http/informatik/gcc_docs/ld_3.html

To be continue...