2013-11-28 26 views
1

我試圖運行此命令LD:未知的選項:在Mac OS X特立獨行-Ttext

ld -Ttext 0x1000 -o kernel.bin loader.o main.o video.o 

但它返回ld: unknown option: -Ttext

是否有此行爲的任何方案或方法,使LD工作?

這裏寫的是該選項-Ttext存在,但在我的情況下,它表明,沒有 http://linux.about.com/library/cmd/blcmdl1_ld.htm

+0

你甚至想要實現什麼? –

+0

@constantius我正在學習本教程。如果我理解正確,該命令將三個* .o文件鏈接到一個kernel.bin中https://code.google.com/p/onyxkernel/wiki/FirstStep –

回答

-1

ldman頁說:

-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. 

所以你應該

  1. 使用正確的格式:ld -T text 0x1000 -o kernel.bin loader.o main.o video.o
  2. Make確定text存在於當前目錄中,並且確實是鏈接器腳本。
+0

這裏寫入選項-Ttext存在,並且我的命令是正確的 http://linux.about.com/library/cmd/blcmdl1_ld.htm –

+0

@RomaBugaian在示例中,'-T'和'scriptfile'之間有一個空格。 –

0

「-Ttext」是文本(代碼)段在內存中的位置。 macintosh ld不支持該選項。它確實支持「-segaddr text」(它可能不是文本,但可能是_text或__text)。如果你正在編寫一個操作系統,你可能需要一個單獨的工具鏈,因爲Macintosh工具鏈只能用於在Macintosh上使用的機器對象。