私は cortex-a9 ボードに小さなバイナリを書き、次のようなリンカー スクリプトを定義しました。
SECTIONS
{
.text :
{
__text = . ;
*(.vector)
*(.text)
*(.text.*)
}
.rodata :
{
*(.rodata)
*(.rodata.*)
}
.data : {
__data_start = . ;
*(.data)
*(.data.*)
}
. = ALIGN(4);
__bss_start = . ;
.bss :
{
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(4);
}
__bss_end = .;
. = ALIGN(4);
__heap_start = .;
. = . + 0x1000;
. = ALIGN(4);
__heap_end = .;
_end = . ;
PROVIDE (end = .) ;
}
しかし、--gc-sections
未使用のセクションが機能して削除された後、機能__heap_start
する前の値のままの--gc-sections
ようです(コードで出力し、ldフラグを確認します):
arm-linux-gnueabihf-gcc -mcpu=cortex-a7 -msoft-float -nostdlib -Wl,--gc-sections -Wl,--print-gc-sections -Wl,-Ttext,0x04000000 -T csrvisor.lds - WL,-Map,binary.map
未使用のセクションを削除__heap_start
した後、正しい値に変更する方法を知っている人はいますか?--gc-sections