cygwin

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
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

cygwin

Post by df »

just wondering if its possible to get cygwins LD to output an ELF file?? I cant get it to output elf without complaining about non PE files... so I objcopy from PE to ELf-i386...

but I have some code thats valid, yet appears... faulty.. I think objcopy is not converting from pe to elf correctly...

ld --help returns that it supports elf... but I cant make it output elf...

ld: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex

ld: supported emulations: i386pe

anyone got any ideas??
(linker scripts with elf output specified produce the same result as doing --oformat)
-- Stu --
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:cygwin

Post by df »

i'm in the process of building all-targets into binutils for cygwin (boy is it a slow process!).

such an easier process than doing the same thing under djgpp!

hopefully when it finishes, i'll make the bits available for other cygwin users...

this is off the 20021117 release of binutils.
-- Stu --
Xeon

Re:cygwin

Post by Xeon »

Actually, objcopy doesn't screw anything up. All I do is this:
1) ld a pei-i386 copy of a binary named kernel.tmp
2) objcopy copies kernel.tmp into an elf32-i386 binary named kernel.elf
3) remove kernel.tmp

It's quite easy actually, although it would be nice if Cygwin came with an all targets binutils.

-Xeon
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:cygwin

Post by df »

yeah i objcopy too, but I still think its messing up some alignment or offsets with regards of data pages...
-- Stu --
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:cygwin

Post by df »

I WAS RIGHT! whooo...

same code without any changes, just the linker, now the code works 100%... when I output kernel as ELF, no probs.. using old linker which outputs as PE, then objcopy to elf.. bewm. errors in .data offsets, etc! :)

strange thing tho, when linking to create an ELF, i still get the PE operations on non PE, etc... but adding an -m{arch} to the ld line, fixes it all...

first i tried -mi386linux, but that resulted in unloadable kernel... but -mi386bsd works100% fine... so.. still a kludge but output now is okeydokey...

beter than buckleys or none :D
-- Stu --
Post Reply