Thread overview | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 27, 2010 [Issue 4398] New: dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4398 Summary: dmd always uses Windows name mangling for _d_throw Product: D Version: D1 & D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: johannespfau@gmail.com --- Comment #0 from Johannes Pfau <johannespfau@gmail.com> 2010-06-27 10:41:17 PDT --- When calling _d_throw dmd always uses the name _d_throw@4 regardless of the operating system. Dynamic ELF libraries support versioning symbols using the syntax name@version. Therefore when ld encounters _d_throw@4 it reads "symbol _d_throw, version 4" and complains that there is no version 4. As long as this isn't fixed Dynamic D libraries can't be created on operating systems using ELF executables. See also: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=112648 and the links referred in the newspost. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 27, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #1 from Johannes Pfau <johannespfau@gmail.com> 2010-06-27 10:46:51 PDT --- Created an attachment (id=678) Patch for dmd2 Patch for dmd2. This patch also fixes the _seh_longjmp_unwind@4 and _cpp_longjmp_unwind@4 symbols. This might not be necessary, it seems those symbols are used on windows only. This also requires a patch to druntime, and both must be applied or there will be link errors on linux. BTW: If I understand windows name mangling correctly, @4 means the arguments have size 4 bytes. As the argument is a pointer hardcoding it to 4 will not work on 64bit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 27, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #2 from Johannes Pfau <johannespfau@gmail.com> 2010-06-27 10:53:23 PDT --- Created an attachment (id=679) Patch for druntime This is the patch required for druntime. In /src/rt/deh2.d "void _d_throw(Object *h)" must be extern(Windows) for windows and extern(C) for all other platforms. In /src/rt/deh.c "void __stdcall _d_throw(Object *h)" must have __stdcall for windows and "void _d_throw(Object *h)" for all other platforms. The other 2 symbols modified in the dmd patch are not used in druntime. This patch places the whole functions in version blocks. Therefore a lot of code is duplicated. I guess this could be done in a better way, but I could get it to work with e.g. alias. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 27, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #3 from Johannes Pfau <johannespfau@gmail.com> 2010-06-27 11:04:12 PDT --- I wanted to say "but I could _not_ get it to work with e.g. alias". A different solution to this problem is to use extern(C) everywhere, even for windows. This also solves the 64bit problem. However, I'm not sure why __stdcall was used on windows, maybe it is needed (performance related?). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #4 from Leandro Lucarella <llucax@gmail.com> 2010-06-27 17:00:08 PDT --- First of all, thanks for tackling this! I wonder if there is any way to avoid code duplication in druntime, as (unless I'm missing something) the _d_throw() body seems to be the same for Windows and Posix, only the function signature changes. Isn't extern (System) -which, btw, seems to be missing in the docs- exactly for this case? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 Eldar Insafutdinov <e.insafutdinov@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |e.insafutdinov@gmail.com --- Comment #5 from Eldar Insafutdinov <e.insafutdinov@gmail.com> 2010-06-28 03:11:27 PDT --- To avoid code duplication in case extern(System) won't help you here you can use string mixins. P.S. Is it the only issue that prevents dmd from being able to build shared libraries on linux or there are more? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 Jacob Carlborg <doob@me.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |doob@me.com --- Comment #6 from Jacob Carlborg <doob@me.com> 2010-06-28 05:57:47 PDT --- The runtime needs to be modified of course, then there is always the chance of new bugs showing up. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #7 from Leandro Lucarella <llucax@gmail.com> 2010-06-28 06:40:40 PDT --- (In reply to comment #5) > To avoid code duplication in case extern(System) won't help you here Why? Doesn't extern(System) means extern(Windows) if version is Windows and extern (C) if version is Posix? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #8 from Eldar Insafutdinov <e.insafutdinov@gmail.com> 2010-06-28 06:46:39 PDT --- (In reply to comment #7) > (In reply to comment #5) > > To avoid code duplication in case extern(System) won't help you here > > Why? Doesn't extern(System) means extern(Windows) if version is Windows and > extern (C) if version is Posix? Yes that's entirely correct. I meant that in case you have some other types of linkage or other variations in function signature you can use string mixins. Sorry for confusion. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4398] dmd always uses Windows name mangling for _d_throw | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | http://d.puremagic.com/issues/show_bug.cgi?id=4398 --- Comment #9 from Leandro Lucarella <llucax@gmail.com> 2010-06-28 06:50:36 PDT --- (In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #5) > > > To avoid code duplication in case extern(System) won't help you here > > > > Why? Doesn't extern(System) means extern(Windows) if version is Windows and > > extern (C) if version is Posix? > > Yes that's entirely correct. I meant that in case you have some other types of linkage or other variations in function signature you can use string mixins. Sorry for confusion. Woops, my eyes completely ignored the "in case". My mistake =) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation