Ed Jones via llvm-dev
2015-Oct-06 09:27 UTC
[llvm-dev] Changing the libc calling convention
I have been searching for a way to change the default calling convention used for library calls in Clang/LLVM. Although I can see a way to change the calling convention for compiler-rt functions, there does not appear to be a mechanism to achieve this for libc library calls. I have tried a couple of solution: I tried to change the calling convention in the declarations in the library. For some library functions, these declarations appear to conflict with the implicit declaration known to Clang, and I couldn't find an obvious means for a target to override this. Another problem with this approach was that the user could provide their own declarations without a calling convention. I also tried changing the calling convention in LLVM, by adding a hook to TargetLibraryInfo to let the target override it. This worked for trivial cases, but not for function pointers and a couple of other edge cases. I can probably make either solution work for my use case, but I am curious if there is an obvious solution I am missing. Best regards, Edward Jones
David Chisnall via llvm-dev
2015-Oct-06 09:39 UTC
[llvm-dev] Changing the libc calling convention
On 6 Oct 2015, at 10:27, Ed Jones via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Although I can see a way to change > the calling convention for compiler-rt functions, there does not appear > to be a mechanism to achieve this for libc library calls.Can you clarify what you mean by ‘libc’ in this context? Do you mean solely functions that are part of the C standard (which may be in libc, libm, or some other support library), or functions that are actually in a specific library? David
Ed Jones via llvm-dev
2015-Oct-06 09:44 UTC
[llvm-dev] Changing the libc calling convention
Apologies, I mean all functions which are part of the C standard, not simply those which appear in libc. Best regards, Edward Jones On 06/10/15 10:39, David Chisnall wrote:> On 6 Oct 2015, at 10:27, Ed Jones via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Although I can see a way to change >> the calling convention for compiler-rt functions, there does not appear >> to be a mechanism to achieve this for libc library calls. > > Can you clarify what you mean by ‘libc’ in this context? Do you mean solely functions that are part of the C standard (which may be in libc, libm, or some other support library), or functions that are actually in a specific library? > > David >