[Bug ld/14339] MinGW ld omits stubs when linking delay import library and using __declspec(dllimport)

2022-01-02 Thread adamjryan at protonmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=14339

--- Comment #4 from Adam J Ryan  ---
I've also found that adding the WINAPI macro (__stdcall) is also problematic.
It allows the library to load and it fails after the dliNotePreGetProcAddress
query stage and doesn't hit dliNoteEndProcessing.
BTW this ticket (https://www.sourceware.org/bugzilla/show_bug.cgi?id=22676)
will be related as it has the __declspec(dllimport).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/14339] MinGW ld omits stubs when linking delay import library and using __declspec(dllimport)

2022-01-02 Thread adamjryan at protonmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=14339

Adam J Ryan  changed:

   What|Removed |Added

 CC||adamjryan at protonmail dot com

--- Comment #3 from Adam J Ryan  ---
I've also hit this issue and removing the __declspec(dllimport) resolved it.
In the documentation provided by Microsoft it does mention a compiler
optimisation that is performed when this is added as noted in a previous
comment. Documentation is here
https://docs.microsoft.com/en-us/cpp/build/importing-into-an-application-using-declspec-dllimport?view=msvc-170.
Maybe something could be put into the generated assembly of the static wrapper
library to disable compile optimisation for that block.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/14339] MinGW ld omits stubs when linking delay import library and using __declspec(dllimport)

2017-02-07 Thread ssbssa at yahoo dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=14339

Domani Hannes  changed:

   What|Removed |Added

 CC||ssbssa at yahoo dot de

--- Comment #1 from Domani Hannes  ---
At
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=ld/emultempl/pe.em;h=8f41f27709a11c5b3bc4f028c05f7915ce540a86;hb=HEAD#l1768
is this:

/* The following chunk of code tries to identify jump stubs in
   import libraries which are dead code and eliminates them
   from the final link. For each exported symbol , there
   is a object file in the import library with a .text section
   and several .idata\$* sections. The .text section contains the
   symbol definition for  which is a jump stub of the form
   jmp *__imp_. The .idata\$5 contains the symbol definition
   for __imp_ which is the address of the slot for  in
   the import address table. When a symbol is imported explicitly
   using __declspec(dllimport) declaration, the compiler generates
   a reference to __imp_ which directly resolves to the
   symbol in .idata\$5, in which case the jump stub code is not
   needed. The following code tries to identify jump stub sections
   in import libraries which are not referred to by anyone and
   marks them for exclusion from the final link.  */

This code removes the delay-loading stubs as well.

My simple fix/workaround was to check if the last symbol name starts with
"___tailMerge_", and in this case not exclude it from the final link.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/14339] MinGW ld omits stubs when linking delay import library and using __declspec(dllimport)

2012-10-22 Thread xunxun1982 at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14339

xunxun xunxun1982 at gmail dot com changed:

   What|Removed |Added

 CC||xunxun1982 at gmail dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils