我对链接描述文件中的位置计数器有疑问。不知道这是一个错误还是我期待错误的输出。
我有一个 bss 部分
/* Program bss, zeroed out during init. */
.bss :
{
. = ALIGN(4);
__bss_start = .;
*(.bss*)
*(.COMMON*)
. = ALIGN(4);
__bss_end = .;
__heap_start = .;
} >sram_u
__bss_size = SIZEOF(.bss);
我的问题是(__bss_end - __bss_start)
不等于__bss_size
. __bss_end
如果我改为在该部分之外分配,.bss
我会得到预期值。如果我用 elfread 检查节标题,我会得到预期的.bss
大小。
我正在使用的链接器是:
GNU ld (GNU Tools for ARM Embedded Processors) 2.23.2.20131129
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
和海合会
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20131129 (release)
[ARM/embedded-4_8-branch revision 205641]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
所以问题是位置计数器(.
)是否应该在节定义中更新,还是我只是使用错误?
PS:希望我使用正确的术语...