2016-01-20 77 views
0

我想从LD脚本中输出一个额外的变量(即带有指向它的符号的数据块)。该变量将包含常量值,或者包含输出文件同一部分中各种其他变量的偏移量和大小。换句话说,我想从LD脚本创建一个头文件。将内容直接添加到来自LD脚本的部分

我可以使用定制的C文件来引用LD脚本中定义的符号,但我不知道是否可以避免这个额外的步骤,并直接在LD脚本中执行。可能吗?

回答

0

终于找到了LD的文档的方式:(http://www.math.utah.edu/docs/info/ld_3.html#SEC17)的情况下

BYTE(expression) 
SHORT(expression) 
LONG(expression) 
QUAD(expression) 
    By including one of these four statements in a section definition, 
    you can explicitly place one, two, four, or eight bytes 
    (respectively) at the current address of that section. QUAD is only 
    supported when using a 64 bit host or target. Multiple-byte 
    quantities are represented in whatever byte order is appropriate for 
    the output file format (see section BFD). 

问题仍然开设有更好的答案。

相关问题