ld:未知选项:-Mac OS X maverick上的Ttext

ld:未知选项:-Mac OS X maverick上的Ttext,c,linker,command,ld,C,Linker,Command,Ld,我正在尝试运行此命令 ld -Ttext 0x1000 -o kernel.bin loader.o main.o video.o 但它返回ld:unknown选项:-Ttext 有没有其他方法可以替代这一行动或使ld发挥作用 这里写到,选项-Ttext存在,但在我的例子中,它表明没有 ld的man页面上说: -T scriptfile --script=scriptfile Use scriptfile as the linker script. This sc

我正在尝试运行此命令

ld -Ttext 0x1000 -o kernel.bin loader.o main.o video.o 
但它返回
ld:unknown选项:-Ttext

有没有其他方法可以替代这一行动或使ld发挥作用

这里写到,选项-Ttext存在,但在我的例子中,它表明没有
ld
man
页面上说:

   -T scriptfile
   --script=scriptfile
       Use scriptfile as the linker script.  This script replaces ld's
       default linker script (rather than adding to it), so commandfile
       must specify everything necessary to describe the output file.
       If scriptfile does not exist in the current directory, "ld" looks
       for it in the directories specified by any preceding -L options.
       Multiple -T options accumulate.
所以你应该

  • 使用正确的格式:
    ld-T text 0x1000-o kernel.bin loader.o main.o video.o
  • 确保当前目录中存在
    text
    ,并且确实是链接器脚本

  • “-Ttext”是文本(代码)段在内存中的位置。macintosh ld不支持该选项。它确实支持“-segaddr text”(它可能不是文本,但也可能是_text或u text)。如果您正在编写一个操作系统,您可能需要一个单独的工具链,因为macintosh工具链仅为macintosh上使用的mach-o对象而设计

    你到底想达到什么目的?@constantius我正在学习本教程。如果我理解正确,这个命令将三个*.o文件链接到一个kernel.bin这里写的是选项-Ttext存在,我的命令是正确的@RomaBugaian示例中
    -T
    scriptfile
    之间有一个空格。