Page 1 of 1

need help linking asm files

Posted: Fri Sep 01, 2006 9:20 pm
by thoover
i am using link.ld for the djgpp linker;

Code: Select all

OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
  .text phys : AT(phys) {
    code = .;
    *(.text)
    . = ALIGN(4096);
  }
  .data : AT(phys + (data - code))
  {
    data = .;
    *(.data)
    . = ALIGN(4096);
  }
  .bss : AT(phys + (bss - code))
  {
    bss = .;
    *(.bss)
    . = ALIGN(4096);
  }
  end = .;
}
it works corectly on all O-files exept those made by nasm so i cant start my kernel and that gets agervating any ideas.

Re:need help linking asm files

Posted: Sat Sep 02, 2006 3:29 am
by Pype.Clicker
that could come from a "wrong" output format in nasm command line. make sure the way you call nasm is compatible with the list of accepted object format of LD. [tt]ld --help[/tt] should tell you something like
ld: supported targets: elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big elf64-x86-64 elf64-little elf64-big srec symbolsrec tekhex binary ihex trad-core
so "nasm -faout" might work here, but "nasm -fcoff" would fail miserably. With DJGPP, chances are that "nasm -felf" will fail miserably and "-fcoff" will work better.

Re:need help linking asm files

Posted: Sat Sep 02, 2006 6:40 am
by thoover
I found what was wrong i didnt put all the C programs in the batch it works now sorry for interupting anyone oh and only -faut works