ld: PE operations on non PE file

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
neos

ld: PE operations on non PE file

Post by neos »

I was trying to compile a simple kernel like in the mega-tokyo os faq.

int main() {
}

I run:
gcc -c main.c
then I try to link,
ld --oformat binary -Ttext 1x100000 -o kernel.bin main.o
However I get the error - ld: PE operations on non PE file.
What is wrong? How do I fix this? When gcc -c is run does it format the .o file for pei386 automatically? If so, is there an argument I can pass to gcc at compile time?
Tim

Re:ld: PE operations on non PE file

Post by Tim »

This is normal behaviour for Cygwin. Link to PE format (don't specify --oformat binary) then use objcopy to copy from PE to binary.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:ld: PE operations on non PE file

Post by df »

search the forum, ive written quite a few posts on this topic
-- Stu --
Post Reply