3

I am trying to run this command

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

but it returns ld: unknown option: -Ttext

Is there any alternatives to this action or a way to make ld work?

Here is written, that option -Ttext exists, but in my case it shows that no http://linux.about.com/library/cmd/blcmdl1_ld.htm

Roman Bugaian
  • 354
  • 1
  • 7
  • 22

2 Answers2

3

"-Ttext" is where in memory the text(code) segment will be. The macintosh ld does not support that option. It does support "-segaddr text"(it might not be text, though, it might be _text or __text). If you are writing an operating system, you probably want a separate toolchain because the macintosh toolchain is only designed for mach-o objects for use on the macintosh.

JustinCB
  • 513
  • 4
  • 12
-2

ld's man page says:

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

So you should

  1. Use the correct format: ld -T text 0x1000 -o kernel.bin loader.o main.o video.o
  2. Make sure text exists in the current directory and is indeed a linker script.
Michael Pankov
  • 3,581
  • 2
  • 23
  • 31