elf to coff conversion

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
mindvnas

elf to coff conversion

Post by mindvnas »

how can i convert an elf format file produced by gcc into a coff file for linking? objcopy seems not to be capable of doing it, says

root@hyperspace:~# objcopy -O elf gcctest.o
objcopy: stsq3ZwK: Invalid bfd target
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:elf to coff conversion

Post by df »

objcopy needs to know what ELF is, objcopy --help should make it list what formats it knows. ELF isnt one of them. you need to get/compile binutils to know about elf, coff, etc.
-- Stu --
mindvnas

Re:elf to coff conversion

Post by mindvnas »

ok, how do i then compile coff support into objcopy? i genrally dont know C that much, i like assembly instead :)
Tim

Re:elf to coff conversion

Post by Tim »

Most versions of binutils do support ELF, although DJGPP doesn't. Run objcopy (no parameters) and look at the bottom line.

For example, Cygwin says:

Code: Select all

objcopy: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex
Here, valid ELF targets are elf32-i386, elf32-little and elf32-big. elf on its own (as you wrote) isn't valid.

BTW: are you sure gcc is outputting ELF? If your version of gcc outputs ELF, your version of ld will support ELF.
Post Reply