David Nadlinger
2013-Feb-19 12:56 UTC
[LLVMdev] x86_stdcallcc and extra name mangling on Windows
Hi all, I'm currently working on getting our (LDC) compiler to run on Win32/MinGW, now that DW2-style EH is available for it. The D programming language has a feature equivalent to LLVM module level inline assembly, so we need to at least partly follow the x86 D calling convention (http://dlang.org/abi.html). Most notably, the ABI mandates that the callee cleans the stack. On the various Posixen, we use x86_stdcallcc as a basis and apply some rewrites at the IR level to make things work just well enough. However, on Windows targets this does not work because of the extra name mangling applied. My question: Is there an easy way of disabling the name-mangling part but keep the rest of the CC that I missed? Because I couldn't find anything to that regard, I threw together a quick patch to add a custom calling convention (see attachment). It seems to work for now, but is there a better solution? Thanks, David -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-3.2-x86-d.diff Type: application/octet-stream Size: 6005 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130219/24845fe3/attachment.obj>
Duncan Sands
2013-Feb-19 13:13 UTC
[LLVMdev] x86_stdcallcc and extra name mangling on Windows
Hi David,> I'm currently working on getting our (LDC) compiler to run on > Win32/MinGW, now that DW2-style EH is available for it. The D > programming language has a feature equivalent to LLVM module level > inline assembly, so we need to at least partly follow the x86 D > calling convention (http://dlang.org/abi.html). > > Most notably, the ABI mandates that the callee cleans the stack. On > the various Posixen, we use x86_stdcallcc as a basis and apply some > rewrites at the IR level to make things work just well enough. > However, on Windows targets this does not work because of the extra > name mangling applied. > > My question: Is there an easy way of disabling the name-mangling part > but keep the rest of the CC that I missed? Because I couldn't find > anything to that regard, I threw together a quick patch to add a > custom calling convention (see attachment). It seems to work for now, > but is there a better solution?if you use "\1" + "usual name", it will disable name mangling if you are lucky. A leading \1 is LLVM's way of saying: leave this name alone! Ciao, Duncan.
Maybe Matching Threads
- [LLVMdev] x86_stdcallcc @<n> mangling vs. '\1' prefix [was: x86_stdcallcc and extra name mangling on Windows]
- [LLVMdev] x86_stdcallcc @<n> mangling vs. '\1' prefix [was: x86_stdcallcc and extra name mangling on Windows]
- [LLVMdev] x86_stdcallcc @<n> mangling vs. '\1' prefix [was: x86_stdcallcc and extra name mangling on Windows]
- [LLVMdev] x86_stdcallcc @<n> mangling vs. '\1' prefix [was: x86_stdcallcc and extra name mangling on Windows]
- [LLVMdev] x86_stdcallcc @<n> mangling vs. '\1' prefix [was: x86_stdcallcc and extra name mangling on Windows]