delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/13/20:35:26

X-Spam-Check-By: sourceware.org
Message-ID: <45591D47.F49873AF@dessent.net>
Date: Mon, 13 Nov 2006 17:35:03 -0800
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: "Salvatore D'Angelo" <koala DOT gnu AT tiscali DOT it>
CC: cygwin AT cygwin DOT com
Subject: Re: ld: cannot perform PE operations on non PE output file 'bootsect'.
References: <45590DE6 DOT 4040106 AT tiscali DOT it>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Salvatore D'Angelo wrote:

> On Linux it works fine but in cygwin I go the following link problem:
> 
> *ld: cannot perform PE operations on non PE output file 'bootsect'.
> 
> *In the cygwin mail archive I saw question like this without response
> please can someone suggest me what is wrong in my Makefile and what I
> have to change?

That's because 'as' and 'ld' on Linux and Cygwin are not configured for
the same default targets.  On Linux they create ELF objects, whereas on
Cygwin the native format is PE.  Whatever tutorial or set of
instructions you are following seem to assume an ELF assembler and
linker.

You might be able to make it work with PE by using objcopy to convert
instead of --oformat, along the lines of:

ld -Ttext 0x0 -s -o bootsect.tmp bootsect.o && \
objcopy -I pei-386 -O binary bootsect.tmp bootsect && \
rm bootsect.tmp

But this will fail if you try to do anything non-trivial that makes use
of any kind of ELF assembler directives.  Perhaps the better way to
proceed would be to build and install a cross-binutils (configure
--target=i686-pc-linux) and then use 'i686-pc-linux-as' and
'i686-pc-linux-ld' instead of 'as' and 'ld' and your Makefiles and
whatever other tutorials/samples/guides ought to all work exactly as on
an ELF system.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019