0

私は 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

4

1 に答える 1