delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/04/23/11:13:36

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <480F5202.DAE3FB6E@dessent.net>
Date: Wed, 23 Apr 2008 08:13:06 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: "san DOT temporal AT gmail DOT com" <san DOT temporal AT gmail DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: Fwd: gcc does not honor -fno-leading-underscore flag?
References: <89ed9b610804221310p4ba3bdf1gf2cd40030793bd34 AT mail DOT gmail DOT com> <89ed9b610804221319g6e9e6c7cm1077c64cb1f32dda AT mail DOT gmail DOT com> <480E4A57 DOT 2EF8731A AT dessent DOT net> <480F4734 DOT 7000705 AT gmail DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

"san DOT temporal AT gmail DOT com" wrote:

> You may be right. But then this is strange for me. I would guess that
> either -fleading-underscore or -fno-leading-underscore do something, but
> not both doing nothing. So if a target does have a leading underscore
> and then -fleading-underscore does nothing on it (according to what you
> say), then I would expect -fno-leading-underscore removing the underscore.

Adding an extra underscore on a platform that doesn't have one isn't
doing anything that you couldn't equivalently accomplish at the source
level, so it's not really violating any ABIs.  However, removing the
underscore when the platform spec says that all symbols must have a
leading underscore prepended would violate the ABI, and there is no
way[1] to achieve the equivalent thing at the source level so this is a
much more dangerous proposition.

That is the intent of the switch; it is not designed for what you're
trying to make it do.

> I suspected this, but I was not sure. I do not know what is ELF and
> PE... I though about trying since I have Windows apps that work on
> Cygwin, but possibly they are much more similar.

I think you are confused about what Cygwin is.  It is not a binary
emulator of any kind, it is a Win32 library just like any other DLL. 
All Cygwin apps are standard Win32 executables/libraries, there is no
difference as far as the operating system is concerned.

The reason you cannot use an object compiled with a Linux compiler is
because Linux uses an entirely different binary format and ABI.  Even
though they may run on the same identical hardware, the details of how
things work at the assembler and linker level are significantly
different.  The fact that it's gcc on both sides doesn't change
anything, because gcc's behavior is determined entirely by the target it
was configured for; two gccs of different targets are essentially two
totally different compilers.

Brian

[1] well technically it's possible using __asm__("") but that's an
extension and not standard C.

--
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