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

Programming, for all ages and all languages.
Post Reply
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

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

Post 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
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

What's the output of "ld -v"? IIRC, we had a similar problem recently with someone using an ancient binutils version...
Every good solution is obvious once you've found it.
Post Reply