digitalmars.D.bugs - [Issue 3956] New: linker removes underscore from all exported symbols of a module but the first
- d-bugmail puremagic.com (47/48) Mar 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3956
- d-bugmail puremagic.com (10/10) Dec 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3956
- d-bugmail puremagic.com (13/13) Sep 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3956
- d-bugmail puremagic.com (10/10) Sep 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3956
- d-bugmail puremagic.com (6/6) Sep 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3956
- d-bugmail puremagic.com (37/37) Sep 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3956
- d-bugmail puremagic.com (10/10) Sep 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=3956
http://d.puremagic.com/issues/show_bug.cgi?id=3956 Summary: linker removes underscore from all exported symbols of a module but the first Product: D Version: unspecified Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Optlink AssignedTo: nobody puremagic.com ReportedBy: r.sagitario gmx.de PST --- this test program: module testexport; export void foo1() {} export void foo2() {} export void foo3() {} void main() {} compiles, but exports in the resulting executable (not a DLL here for simplicity) are wrong.dumpbin /exports testexport.exe[...] ordinal hint RVA name 1 0 00003014 D10testexport4foo2FZv 2 1 00003018 D10testexport4foo3FZv 3 2 00003010 _D10testexport4foo1FZv [...] The object file seems ok, here's a snippet from obj2asms' output: extrn _D10testexport4foo1FZv ;expdef expflag=x00, export '_D10testexport4foo1FZv', internal '', ordinal=x0 extrn _D10testexport4foo2FZv ;expdef expflag=x00, export '_D10testexport4foo2FZv', internal '', ordinal=x0 extrn _D10testexport4foo3FZv ;expdef expflag=x00, export '_D10testexport4foo3FZv', internal '', ordinal=x0 [...] public _D10testexport12__ModuleInfoZ _D10testexport4foo1FZv COMDAT flags=x0 attr=x0 align=x0 _D10testexport4foo2FZv COMDAT flags=x0 attr=x0 align=x0 _D10testexport4foo3FZv COMDAT flags=x0 attr=x0 align=x0 __Dmain COMDAT flags=x0 attr=x0 align=x0 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3956 Rainer Schuetze <r.sagitario gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com PST --- *** Issue 7186 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 31 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3956 Martin Nowak <code dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |dll CC| |code dawg.eu Severity|normal |major This just broke my shiny new loadFunc, loadSym implementation and it took me +1h to get here. Any ideas how to fix this? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 27 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3956 Presumably something in this TWEAK_EXPORT_NAMES function goes wrong or the function isn't called under certain circumstances. It seems simple enough to remove the underscore striping altogether. Is it possible to debug optlink with some debug infos. How to build this thing? https://github.com/DigitalMars/optlink/blob/475bc5c1fa28eaf899ba4ac1dcfe2ab415db16c6/common/coment.asm#L529 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 27 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3956 #ifdef fg_pe -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3956 YES_EXPORT PROC ;; ... #ifdef fg_pe if (OUTPUT_PE) // false on first test TWEAK_EXPORT_NAMES(); #endif DEFINE_EXPORT(); // could set ANY_USE32, but it's usually already SELECT_OUTPUT_SEGMENTED_OR_PE(); ;; ... YES_EXPORT ENDP SELECT_OUTPUT_SEGMENTED_OR_PE PROC if (!(OUTPUT_SEGMENTED | OUTPUT_PE)) return; if (ANY_USE32) // this is already set by defining the output segments SELECT_OUTPUT_PE(); // sets OUTPUT_PE else SELECT_OUTPUT_SEGMENTED(); SELECT_OUTPUT_SEGMENTED_OR_PE ENDP I found the bug, thanks to OllyDbg, but I could use some help to interpret and resolve it. From what I understand optlink determines the output format OUTPUT_SEGMENTED or OUTPUT_PE depending on the input files. That is when it first encounters some usage of 32-bit symbols it will set ANY_USE32. Striping the leading underscore in the exported name is only done for OUTPUT_PE. The problem comes from the circular dependency in the OUTPUT_PE test above. For the first export symbol no output format has yet been set, thus the test fails and the symbol is not stripped. One way to resolve this would be to prematurely test for ANY_USE32 if no OUTPUT is selected. if (OUTPUT_PE || !OUTPUT_SEGMENTED && ANY_USE32) Any ideas? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3956 Martin Nowak <code dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/DigitalMars/optlink/pull/10 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2013