Page 1 of 1

No matter what I do, it links this file first! x-[

Posted: Sat Apr 07, 2007 2:44 pm
by earlz
Well I have been trying for about 2 hours to get this to link right
the C file doesn't have anything special and my asm file has the entry point symbol(and I set it to format coff) and the asm file is the first object in the command line!
now which makes sense to link first? the asm file right? No, not this screwed up crap!

I have tried everything but there is no way to get about this working it just demands to link the C file first!

the only difference between them that could matter is the size of object files, the C file is bigger there, but could that make a difference!?

this is my linker script

Code: Select all


ENTRY(start)
SECTIONS
{
  .text  0x100000 : {
    *(.text)
  }
  .data  : {
    *(.data)
  }
  .bss  :
  {
    *(.bss)
  }
}
btw I use objcopy to strip symbols and headers
makefile:

Code: Select all

_OBJS=.objs/kernel/kernel.o
_CFLAGS= -nostartfiles -ffreestanding -nostdlib -nostdinc -s -I./include -march=i486 -DDEBUG -DNDEBUG
_LFLAGS=-s -nostartfiles -nostdlib -Tlink.ld
_FLOPPY_DRIVE=B:

default:
	fasm asm.asm asm.o
	gcc $(_CFLAGS) -c kernel/kernel.c -o .objs/kernel/kernel.o
	ld $(_LFLAGS) -o jouleos.bin asm.o $(_OBJS) 
	objcopy -O binary jouleos.bin

Posted: Sun Apr 08, 2007 1:19 am
by Solar
What's the output of "ld -v"? IIRC, we had a similar problem recently with someone using an ancient binutils version...