[LLVMdev] question about alignment of structures on the stack (arm 32)

Alexey Perevalov alexey.perevalov at hotmail.com
Fri Apr 24 01:53:10 PDT 2015



----------------------------------------
> Date: Thu, 23 Apr 2015 09:33:58 -0700
> Subject: Re: [LLVMdev] question about alignment of structures on the stack (arm 32)
> From: t.p.northover at gmail.com
> To: alexey.perevalov at hotmail.com
> CC: llvmdev at cs.uiuc.edu; lubos at dolezel.info
>
>>> void func(int x, long long y)
>>>
>>> iOS will pass y in registers r1 and r2. ELF code will expect it in
>>> registers r2 and r3. Similar effects happen to arguments that get
>>> passed on the stack.
>> Strange, but in that simple case on ELF I got,
>> mov r0, #1
>> mov r1, #18
>> mov r2, #0
>> bl long_long_func
>> with the same endian as on iOS,
>
> That almost certainly means you're using the wrong triple on Linux
> (and so would have problems calling system library functions with that
> signature). Most ARM linux distributions these days use
> arm-linux-gnueabihf (or possibly arm-linux-gnueabi, the difference
> being where floating-point arguments get passed).
>
You totally right.

> If that's changed in your upgrade to 3.6, it might account for you
> seeing "add" instead of "orr" now, too.
>
>>> I wouldn't rely on this. Trunk emits orr again, it's likely just a
>>> random code perturbation and will bite you elsewhere without a real
>>> solution.
>>>
>> Trunk of llvm's source code ) ?
>
> Yes.
>
> Tim.
 		 	   		  



More information about the llvm-dev mailing list