[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/14339] New: MinGW ld omits stubs when linking delay import libra
From: |
thfabba at gmx dot de |
Subject: |
[Bug ld/14339] New: MinGW ld omits stubs when linking delay import library and using __declspec(dllimport) |
Date: |
Sun, 08 Jul 2012 12:19:14 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=14339
Bug #: 14339
Summary: MinGW ld omits stubs when linking delay import library
and using __declspec(dllimport)
Product: binutils
Version: 2.22
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: address@hidden
ReportedBy: address@hidden
Classification: Unclassified
Created attachment 6520
--> http://sourceware.org/bugzilla/attachment.cgi?id=6520
Test case source
Delay import libraries contain stubs in the form of:
address@hidden:
00000000: FF 25 00 00 00 00 jmp dword ptr [.idata$5]
00000006: B8 00 00 00 00 mov eax,offset .idata$5
0000000B: E9 00 00 00 00 jmp ___tailMerge_libws2_32_delayed_a
These are then referenced in the corresponding .idata section à la:
RAW DATA #5
00000000: 06 00 00 00 ....
RELOCATIONS #5
Symbol Symbol
Offset Type Applied To Index Name
-------- ---------------- ----------------- -------- ------
00000000 DIR32 00000006 0 .text
When using __declspec(dllimport), only the symbol in .idata$5
(address@hidden) is referenced, not address@hidden in the .text section.
This apparently causes the linker to omit the stub, and turn the corresponding
relocation into a no-op (i.e. the application will call the address 6).
--whole-archive has no effect on this, the stubs are still omitted.
Linking the individual object files as extracted from the library DOES produce
correct output, though.
Adding '-u address@hidden' to the command line also seems to work.
I've made a small test case including an analysis of the generated code.
The source for this test case is attached. It can also (including compiled
binaries and disassembly) be found at:
http://thfabba.ath.cx/~thfabba/pub/delaylib/
I've tested this with ld version 2.20.51.20091222 (ReactOS Build Environment),
as well as MinGW's 2.22 and MinGW-w64's 2.22.51.20111217.
Possibly, but not necessarily related to bug 12614.
--
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/14339] New: MinGW ld omits stubs when linking delay import library and using __declspec(dllimport),
thfabba at gmx dot de <=