Page 1 of 1

ld: PE operations on non PE file

Posted: Fri Apr 04, 2003 10:08 am
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?

Re:ld: PE operations on non PE file

Posted: Fri Apr 04, 2003 11:05 am
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.

Re:ld: PE operations on non PE file

Posted: Sat Apr 05, 2003 1:40 pm
by df
search the forum, ive written quite a few posts on this topic