This is the mail archive of the cygwin 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: Fwd: gcc does not honor -fno-leading-underscore flag?


"san.temporal@gmail.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/


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