5

Do WinCE and Linux use the same calling convention on ARM? What are the differences?

The documents I've found so far do not explain very well. For example on http://msdn.microsoft.com/en-us/library/ms864497.aspx, it says "Windows CE .NET Compiler" on one line, but "the ARM compiler" on the next line, and "CLARM" at the bottom, and it's not clear whether it is referring to the same compiler or different compilers. Here's what I've found so far...

The reason I ask is that I'd like to try using LLVM in WinCE to generate some simple code at run-time, but it only officially supports Linux.

Community
  • 1
  • 1
Qwertie
  • 16,354
  • 20
  • 105
  • 148
  • Do you means stdcall vs cdecl? The WinAPI is stdcall. I assume you are trying to port code onto x96? For gcc _cdecl is the default on Linux. I do not know about ARM. look here: http://www.programmersheaven.com/2/Calling-conventions#cdecl – jim mcnamara Jul 16 '10 at 21:44
  • I believe "stdcall" is a x86 term which does not apply to ARM. Most likely the calling convention would be called "cdecl" within C++ programs, but that doesn't mean it's the same between Windows and Linux. – Qwertie Jul 16 '10 at 21:58

2 Answers2

2

Calling conventions are something that are implemented by the compiler and are not operating system specific. Having said that I can confirm that both gcc and RVCT (ARM's c/c++ compiler) both generate code that follow the Procedure call convention for ARM architecture that you mentioned above.

Looking at the link to the Microsoft documentation, I can also confirm that it follows the ARM calling convention.

doron
  • 27,972
  • 12
  • 65
  • 103
  • 3
    If you want to be able to call OS-defined functions (and supply callbacks to those functions) then the calling convention is OS-specific. I would expect a compiler, by default, to use the calling convention expected by the OS, so that callback functions can be passed to it.... but you're right, the compiler could use something different. What about exception handling? It might require that all compilers follow certain conventions so that the stack can be unwound reliably. – Qwertie Jul 27 '10 at 15:39
1

I came across the exact same question for which I tried to find an answer. Namely where / what document says something or defines the ARM ABI used under LINUX.

The following document is the closest I came to an answer

ARM GNU/Linux Application Binary Interface Supplement

it is by CodeSourcery and in encoded in its abstract lies in my opinion an answer to the question above, namely that:

The Application Binary Interface (ABI) for the ARM Architecture ( a document published by ARM Ltd ) specifies various aspects of compilation and linkage required for interoperation between toolchains used for the ARM Architecture.

However, as the ABI published in this document is designed without reference to a particular operating system, there are certain aspects which remain unspecified.

Apparently the document by CodeSourcery, is intended to supplement the ABI for the ARM Architecture by specifying the decisions made for these aspects when using the GNU/Linux operating system.

I supply one link to this document ( others could be found by searching for the document's title ):

http://www.boost.org/doc/libs/1_51_0_beta1/libs/context/doc/pdf/arm-linux-aapcs.pdf

It seems that a standard specifying the ARM ABI under LINUX didn't exist, and again it seems that the document by CodeSourcery is an attempt at covering this aspect.

darbehdar
  • 111
  • 5