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

Tim Northover t.p.northover at gmail.com
Thu Apr 23 09:33:58 PDT 2015


>> 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).

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