Displaying 2 results from an estimated 2 matches for "getcharact".
2015 Apr 20
2
[LLVMdev] question about alignment of structures on the stack (arm 32)
Dear community,
I faced with code which was generated by llvm, assembly instructions of that code is relying on 8-bytes alignment for structures on the stack.
The part of Objective C code is following:
-(void)getCharacters:(unichar *)unicode {
NSRange range;
range.location = 0;
range.length = [self length];
printf("%p, %p\n", &range.location, &range.length);
And before printf call I see an argument preparation, and one of the most interesting instruction
orr r3, r2, #4 ;f...
2015 Apr 21
2
[LLVMdev] question about alignment of structures on the stack (arm 32)
...MachO on the ARM stack is 4-bytes aligned. Code produced for ELF expects 8-bytes alignment.
So in 50% cases when call made from MachO to ELF stack pointer register contains not a 8-bytes aligned address.
Even in case of trivial call
NSLog(@"Test string") from MachO
it leads to -[NSString getCharacters:]
------
-(void)getCharacters:(unichar *)unicode {
NSRange range={0,[self length]};
[self getCharacters:unicode range:range];
}
------
when "range" is copying by value, and second field of "range" is evaluated incorrectly,
its address evaluated as address of the struct...