gas中嵌入数据.incbin

.incbin "file"[,skip[,count]]
  The incbin directive includes file verbatim at the current location. You can control the search paths used with the ‘-I’ command-line option . Quotation marks are required around file. The skip argument skips a number of bytes from the start of the file. The count argument indicates the maximum number of bytes to read. Note that the data is not aligned in any way, so it is the user’s responsibility to make sure that proper alignment is provided both before and after the incbin directive.

查看arch/unicore/boot/compressed下的piggy.S:

.section .piggydata,#alloc
.globl input_data
input_data:
  

  .incbin "arch/unicore/boot/compressed/piggy.gz"


.globl input_data_end
input_data_end:

在这里运用汇编指示符,将由Image压缩而成的piggy.gz嵌入到 piggy.S中,注意此处额外声明了两个全局符号:input_data   input_data_end

posted on 2012-04-18 13:53  阿加  阅读(673)  评论(0编辑  收藏  举报

导航