Memory management 使用ld链接器脚本没有内存填充

Memory management 使用ld链接器脚本没有内存填充,memory-management,gcc,linker,ld,arm7,Memory Management,Gcc,Linker,Ld,Arm7,这是我的问题: 我创建了一个链接器脚本,它将我的代码划分为不同的区域。 这就是链接器脚本: OUTPUT_ARCH(arm) SECTIONS { . = 0x400000; .stack1 : { __stack_start1 = . ; } . = 0x800000; .stack2 : { __stack_start2 = . ; } . = 0x19900000; .vectors1 : { *(.resetvector1) } . = 0x199000

这是我的问题: 我创建了一个链接器脚本,它将我的代码划分为不同的区域。 这就是链接器脚本:

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)
}

}
它工作得很好,但是当整个程序大约只有几kb时,输出文件大约是450Mb!! 为什么? 我认为ld(用0x0)填充堆栈、数据、文本等区域之间的空白区域。 如何避免这个问题

提前感谢。

我会尝试使用.sectionname位置语法,而不是。=地点:第二节。如果这不起作用,用内存定义单独的内存区域并使节转到那里肯定会停止这种行为。

我会尝试使用.sectionname位置语法,而不是地点:第二节。如果这不起作用,用内存定义单独的内存区域并使部分转到那里,肯定会停止这种行为