ld from djgpp errors

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yan

ld from djgpp errors

Post by yan »

ld returned some errors when I link memory.o,page.o.
The program ld came from a package which can be downloaded at http://www.osdever.net/downloads/other/ ... ls2112.zip
and if I link the two files with ld -r -o mm.o memory.o page.o,it runs ok.En,what's the different between elf_i386 and i386-go32?How to creat a ld.exe under win system?(I mean if the version of this ld is too low?).The most important,
is there any way else I can creat the mm.o file correctly?

(you can download tomm.zip which contains mm.o and memory.o at http://tmxk.net/312/tomm.zip if you want to help me :))

ld -m elf_i386 -r -o mm.o memory.o page.o
Exiting due to signal SIGFPE
Division by Zero at eip=00047af8, x87 status=0000
eax=00000000 ebx=00127b10 ecx=00000000 edx=00000000 esi=00120d70 edi=0000000
ebp=0011a948 esp=0011a860 program=d:\DJGPP\BIN\ld.exe
cs: sel=01ff base=01da0000 limit=0013ffff
ds: sel=0207 base=01da0000 limit=0013ffff
es: sel=0207 base=01da0000 limit=0013ffff
fs: sel=01d7 base=00009ab0 limit=0000ffff
gs: sel=0217 base=00000000 limit=0010ffff
ss: sel=0207 base=01da0000 limit=0013ffff
App stack: [0011a9c0..0009a9c0] Exceptn stack: [0009a914..000989d4]

Call frame traceback EIPs:
0x00047af8
0x0001cb30
0x0001a308
0x00082552
make.exe: *** [mm.o] Error -1
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:ld from djgpp errors

Post by Pype.Clicker »

elf_i386 is an ELF target, while i386_go32 is a COFF file within a MS-DOS program that enters pmode and loads it ...

there are chances that your .O files you give to LD are *not* ELF files but rather COFF files ... You can know by looking at them through an hex editor (the 3 first bytes of an ELF are 'E' 'L' 'F' ...)
yan

Re:ld from djgpp errors

Post by yan »

Thanks Very Much.

Well,when I link them with another ld whose version is lower,it returns a message.
According to what it said,I changed "AS   =as" in Makefile to "AS   =as --em=i386elf",and it works ok now.

Oh,I nearly forget it.
I also did all of these below:
1. Find the SPECS file. It usually resides in drive:/djgpproot/lib/gcc-lib/djgpp/3.04.
2. Change the line --traditional-format (next to *asm:) to --em=i386elf, so that GAS will

always produce ELF object files.
3. Delete the line %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}

(usually the last one), so that your ELF files won't get a DJGPP stub attached to them.
4. Create an empty djgpp-x.djl file in the same directory.
5. Always run LD with -m elf_i386 so that it will produce ELF executables.
(from "DJGPP port of GNU Bintuils 2_11_2 with ELF support.htm")
Post Reply