Possibly wrong address passed to callq asm instruction within MPIR test binaries

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Apr 7 15:39:00 GMT 2014


On Apr  7 14:47, Jean-Pierre Flori wrote:
> Le Mon, 07 Apr 2014 16:36:18 +0200, Corinna Vinschen a écrit :
> > At this point gcc doesn't know that foo will get exported from a DLL,
> > but it generates the .def directive nevertheless.  If I create the same
> > code in gas:
> > 
> > 	.text .globl nothing .def   nothing; .scl 2; .type 32; .endef
> > nothing:
> > 	ret
> > 
> > then it works, but crashes if I omit the .def directive.  So it seems to
> > me you don't have to export the symbol using the dllimport/dllexport
> > directives, but you have to specify the symbol explicitely for export.
> > 
> Exactly!
> I came to the same conclusion.
> On top of that, it seems that including the export stuff does not hurt 
> when building and linking a static lib.
> 
> What's strange is that when we use the dllimport magic then it works even 
> though the symbol was not explicitely exported.

Perhaps not.  With dllimport, the calling code expects having to import
a symbol from the DLL, so it generates an IAT entry and everything works
as expected.  Along these lines, at least.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140407/e1003e30/attachment.sig>


More information about the Cygwin mailing list