This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: don't want leading underscore


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]