Trouble with automatic symbol export/import on Cygwin64

Jean-Pierre Flori jpflori@gmail.com
Mon Apr 7 15:50:00 GMT 2014


Le Mon, 07 Apr 2014 13:48:54 +0200, Jean-Pierre Flori a écrit :

> Dear all,
> 
> While preparing a new release of MPIR (mpir.org) we encountered issues
> on Cygwin64.
> A detailed discussion of the issue is already available on Cygwin
> mailing list:
> http://cygwin.com/ml/cygwin/2014-04/msg00005.html and follow-ups.
> 
> Quickly it seems the problem seem to be that calling assembly defined
> functions (assembled with yasm) without the __declspec(dllimport)
> magic leads to a "callq" instruction with a chopped off address instead
> of a correct magic trampoline code.
> This seems to be the case with both gcc 4.7.3 and 4.8.2 but the culprit
> might be elsewhere.
> Our current solution is to use the _declspec(dllimport) magic, but as it
> should not be necessary anymore, it would be nice to understand what is
> going wrong here.
> 
> Looking a little bit at the import lib produced by gcc, it seems that
> problematic symbols have the __nm_ prefix, whereas non-problematic one
> don't.
> Any clue on how this is decided?
> In particular, when tryng to compile a minimal lib with dummy function I
> don't get __nm_ prefixes.
> 
> Best,
Ok, it seems we got the problem:
assembly files in MPIR don't add the yasm export directive (.def for 
gas), whereas gcc/gas add it by default ;
whence the discrepancies in symbol produced in the import library.



More information about the Gcc-help mailing list