Chinaunix

标题: 再问boot0.s。。。它的makefile文件 [打印本页]

作者: wellbye    时间: 2006-04-06 13:32
标题: 再问boot0.s。。。它的makefile文件
  1. ORG=        0x600

  2. boot0: boot0.o
  3. .if ${OBJFORMAT} == aout
  4.         ${LD} -N -s -T ${ORG} -o boot0.out boot0.o
  5.         dd if=boot0.out of=${.TARGET} ibs=32 skip=1
  6. .else
  7.         ${LD} -N -e start -Ttext ${ORG} -o boot0.out boot0.o
  8.         objcopy -S -O binary boot0.out ${.TARGET}
  9. .endif
复制代码


连接时,给ld带了个-T选项,并且将ORG作为参数。
看意思这应该就是所谓的“重定位”了。可是我查ld的手册,-T选项是用来指定一个make脚本的,不是重定位的意思。而且我在自己上用-T 0x600来调用ld也报语法错,这是怎么回事呢?
作者: 雨丝风片    时间: 2006-04-06 13:52
原帖由 wellbye 于 2006-4-6 13:32 发表
[code]ORG=        0x600

boot0: boot0.o
.if ${OBJFORMAT} == aout
        ${LD} -N -s -T ${ORG} -o boot0.out boot0.o
        dd if=boot0.out of=${.TARGET} ibs=32 skip=1
.else
        ${LD} -N -e start -Ttext ${ORG} -o b ...



man ld
       --section-start sectionname=org
           Locate  a  section in the output file at the absolute address given
           by org.  You may use this option as  many  times  as  necessary  to
           locate multiple sections in the command line.  org must be a single
           hexadecimal integer; for compatibility with other linkers, you  may
           omit  the  leading  0x  usually associated with hexadecimal values.
           Note: there should be  no  white  space  between  sectionname,  the
           equals sign (``=''), and org.

       -Tbss org
       -Tdata org
       -Ttext org
           Same  as  --section-start,  with  ".bss", ".data" or ".text" as the
           sectionname.





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2