Page 1 of 1

LD crashing

Posted: Mon Apr 12, 2004 9:30 am
by Dragon88
Below is my linker script, when I try to link with it, LD illegal ops (I'm using windows 98 SE). If I comment out the output format line it will work, it's only when I try to make LD output a binary file that it doesn't work. I have LD version 2.9.4 with BFD version 2.9.4 as well.

EDIT: LOL was in such a hurry I forgot the script :D *smacks self on forehead* I couldn't find a newer version for windows. They're up to 2.14, but I'm not interested in compiling a source tarball.

Code: Select all

/* link.ld */
OUTPUT_FORMAT("binary")
ENTRY(_main)
SECTIONS
{
???.text 0xA0000:
???{
??????code = .;_code = .;__code = .;
??????*(.text .rodata)
??????. = ALIGN(4096);
???}
???.data :
???{
??????data = .;_data = .;__data = .;
??????*(.data)
??????. = ALIGN(4096);
???}
???.bss :
???{
??????bss = .;_bss = .;__bss = .;
??????*(.bss)
??????. = ALIGN(4096);
???}

???end = .;_end = .;__end = .;
}

Re:LD crashing

Posted: Mon Apr 12, 2004 10:50 am
by Pype.Clicker
no script seen below ... where does your LD comes from and did you made sure there was no bugreport/newer version there ?

Re:LD crashing

Posted: Wed Apr 14, 2004 11:02 pm
by virusx
hi,
try using
ld -oformat binary

It is same as using OUTPUT_FORMAT ("binary")
regards virusx

Re:LD crashing

Posted: Thu Apr 15, 2004 11:42 am
by Dragon88
already tried that. It crashes just the same. I think there is an error in the conversion from object file to binary file.

Re:LD crashing

Posted: Thu Apr 15, 2004 2:02 pm
by Tim
I don't know which distribution you're using, but Cygwin ld always crashes when outputting to anything other than PE.

You should link to PE, then use objcopy to convert to whichever format you want.

Re:LD crashing

Posted: Fri Apr 16, 2004 1:03 pm
by Dragon88
That's what I'm doing right now, but objcopy apparently isn't handling read only data right, so string constants break the kernel. I either need to get LD to output a flat binary, or I need objcopy to handle the sections right.

Re:LD crashing

Posted: Fri Apr 16, 2004 2:10 pm
by Neo
have u tried with DJGPP or CYGWIN?
i use a plain binary format and it has worked with all 3.

Re:LD crashing

Posted: Thu Apr 22, 2004 10:02 am
by Dragon88
yeah, I tried with DJCPP, but it still didn't work... I have no idea why.

Re:LD crashing

Posted: Thu Apr 22, 2004 3:28 pm
by Slasher
Hi,
I think you are linking you text section into video memory address
0xA0000 is the start address for graphics video modes. Change your link address for text section and see if that helps.
if it doesn't then, there is something else wrong in the code it self.

Re:LD crashing

Posted: Fri Apr 23, 2004 10:37 am
by Dragon88
hmmmm... wow... didn't realize I was doing that. That's actually the address I'm loading my kernel to. I guess I should prolly change that!