https://sourceware.org/bugzilla/show_bug.cgi?id=24574
Bug ID: 24574 Summary: extern symbols in dlls are misleading under debugger Product: binutils Version: 2.31 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: sbence92 at gmail dot com Target Milestone: --- Host: x86-64-mingw32 Target: x86-64-mingw32 Build: x86-64-mingw32 Created attachment 11782 --> https://sourceware.org/bugzilla/attachment.cgi?id=11782&action=edit example With binutils 2.31 and later extern symbols in DLLs point to junk when inspected under a debugger. The source of the problem seems to be ld because the bug is reproducible with ld 2.31 and gdb 8.3 but it isn't with ld 2.30 with same gdb. If your run make all in the attached example (after specifying the your toolchain) you find the the address of pcode_st is different in productionCode.dll and test.dll under a debugger. If you change extern prodCode_st pcode_st; in test.cpp to __declspec(dllimport) prodCode_st pcode_st; the problem goes away. linking with --enable-auto-import does not help. toolchain for reproduction: mingw64 gcc 8.3 from msys2 + binutils 2.31.1 from http://repo.msys2.org/mingw/x86_64/ -- 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