delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/04/14:15:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <5.1.0.14.2.20021104104934.02d12380@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Mon, 04 Nov 2002 11:15:42 -0800
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: don't want leading underscore
In-Reply-To: <001501c28431$15b40b20$0100a8c0@axp>
Mime-Version: 1.0

Benjamin,

At 10:36 2002-11-04, you wrote:
>How can I prevent cygwin gcc from producing symbols with leading 
>underscores? ("_main" instead "main")
>
>I want to be binary compatible with linux and other operating systems.

Binary compatible? That really has little meaning since there's far more to 
binary compatibility than how symbols from the program source code are or 
are not adorned when emitted into the object code files.


>What about libgcc.a? Each symbol conatins leading underscores, can I 
>change this?
>cygwin.dll defines both exports, with and without leading underscores 
>isn't it?


Apparently it can be changed. If GCC under Linux doesn't prepend the 
underscore and under Cygwin it does, then it's at some level configurable. 
Get the GCC book ("Using and Porting GNUCC").


This excerpt from the output of "gcc -dumpspecs" suggests leading 
underscores is a configurable option (though I don't know why both 
"leading-underscore" and "no-leading-underscore" are listed:

-==-
*cpp_options:
%(cpp_unique_options) %{std*} %{d*} %{W*} %{w} %{pedantic*} %{fshow-column} 
%{fno-show-column} %{fsigned-char&funsigned-char} %{fleading-underscore} 
%{fno-leading-underscore} %{fno-operator-names} %{ftabstop=*}
-==-

So you can use:

   -fleading-underscore    External symbols have a leading underscore


Here's some mildly interesting output:

% gcc -v --help 2>&1 |egrep -i '(leading)|(underscore)'
   -fleading-underscore    External symbols have a leading underscore
   -fno-underscoring       Disable the appending of underscores to externals
   -fno-second-underscore  Never append a second underscore to externals


Anyway, there's a lot to GCC. Read up on it and you'll probably find out 
about other things you'll need to know to get your binary compatibility.


>Benjamin Kalytta


Randall Schulz
Mountain View, CA USA


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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