Page 1 of 1
link problem
Posted: Sat Mar 08, 2008 1:10 pm
by eddyb
is there any way to link files without put them into the comand line?
Code: Select all
ld -T link.ld -o kernel.bin start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o cmd.o mouse.o vga.o vmodes.o bmps.o dma.o
this don't work because the total size of arguments is over 256 chars
.
have anyone a solution?
Posted: Sat Mar 08, 2008 1:35 pm
by t0xic
use *.o, and rename your start.o to something like start.so etc.
so you can do this:
Code: Select all
ld -T link.ld -o kernel.bin start.so *.o
Posted: Sat Mar 08, 2008 1:37 pm
by kscguru
The linker script (-T argument, yours is link.ld) has commands for including files too. Add the INPUT() link script command:
INPUT(file1 file2 file3)
Reference for ld (GNU-maintained):
http://sourceware.org/binutils/docs-2.1 ... e-Commands
Alternatively, "ld @file" will read a command line from "file"; this is a standard Windows trick for short command lines, but works on all OSes.
Third option is to bundle a bunch of input files into a static library (.a file).
Posted: Sun Mar 09, 2008 1:21 am
by eddyb
kscguru wrote:The linker script (-T argument, yours is link.ld) has commands for including files too. Add the INPUT() link script command:
INPUT(file1 file2 file3)
Thanks.
Worked!