Page 1 of 1
wrong with the linker
Posted: Sat Feb 17, 2007 4:48 pm
by xyjamepa
Hi,
would someone correct me, when I'm trying to execut this batch file
I got this error, okay sure after compiling the files.
Code: Select all
C:\DJGPP\bin\ld -T link.ld -r -o stage1.o start.o video.o
C:\DJGPP\bin\ld -T link.ld -r -o stage2.o main.o str.o stage1.o
C:\DJGPP\bin\ld -T link.ld -o stage3.o pm.o stage2.o
C:\DJGPP\bin\ld -T link.ld -o kernel.bin stage3.o
The error message:
Relocateable linking with relocations from format a.out-i386
(start.o) to format binary (stage1.o) is not supported
THANX
Posted: Sat Feb 17, 2007 6:16 pm
by Tyler
Sounds like you are trying to create an object with relocatable information as a pure binary. The pure binary cannot store relocation data.
Posted: Sat Feb 17, 2007 6:42 pm
by m
You can try
objcopy in UNIX after creating object file with ld.
For example,if you've arranged all the sections in the output file of ld,you can:
to convert your output object fileto a raw binary file.This is only the basic option associated.You can find out more details to fit your situation by reading its man page.(The BFD library supports binary format.)
Posted: Sun Feb 18, 2007 1:06 am
by Candy
C:\DJGPP\bin\ld -T link.ld -r -o stage1.o start.o video.o
C:\DJGPP\bin\ld -T link.ld -r -o stage2.o main.o str.o stage1.o
C:\DJGPP\bin\ld -T link.ld -o stage3.o pm.o stage2.o
C:\DJGPP\bin\ld -T link.ld -o kernel.bin stage3.o
Why are you passing linker options if it's a relocatable linking? Remove the -T link.ld from the first two.
The third line indicates that stage3.o is a final link step, and yet you use it in the 4th line as if it was relocatable. Either make it relocatable (add -r, remove -T link.ld) or don't use it for kernel.bin.
Relocatable linking should usually be from the linkers default format to its default format, using default settings so that it doesn't remove any information required for linking. The final link step should indicate everything you want done to the files so that they end up being exactly right, so use a linker options file for that one.
Just a final thing, why link all these objects in 4 stages? Most people would link them all in one. It's good practice though...
Posted: Mon Feb 19, 2007 11:42 am
by xyjamepa
Just a final thing, why link all these objects in 4 stages? Most people would link them all in one. It's good practice though...
I have much more files than this files but I'm trying to learn how
to link in many steps not one long line ,and also i know how can i link this
files in one single line.
THANX