Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

some bug in xcode's non gnu arm assembler.

this is a very lite demo, taked from my complete hook project.


.syntax unified

.macro .donothing
.text
.private_extern $0
.globl $0
.align 2
.arm
$0:
    movw    r0, :lower16:2f-(1f+8))
    movt    r0, :upper16:2f-(1f+8))
1:
    add     r0, pc, r0
    blx     lr
.cstring
2:
    .asciz $1
.endm

.donothing _getstr, "He llo wor ld !\n"


I added the .s file into xcode, and call it from main.cpp like this


#include <stdio.h>

extern "C" char* getstr();

int main(int argc, char* argv[]) {
    fprintf(stderr, "%s", getstr());
    return 0;
}


only "Helloworld!\n" printed in xcode's lldb console. all space in $1 removed during macro expanding. surely *.o file already have striped version for my string (with otool).

I am using XCode 4.3.3, I think it's totally a bug, not a design.

because the same x64 version working fine.



.macro .donothing
.text
.private_extern $0
.globl $0
.align 2
$0:
    leaq     1f(%rip), %rax
    ret
.cstring
1:
    .asciz $1
.endm

.donothing _getstr, "He llo wor ld !\n"



back to the arm clang/llvm as, I found instruction like

adr r12, label

just let assembler (libexec/arm/as) crash without any output.

ldr r12, =0x8

can crash assemberl sometimes too.

iPhone 4S, iOS 5.1.1, XCode 4.3.3

Posted on Nov 14, 2012 12:18 PM

Reply

There are no replies.

some bug in xcode's non gnu arm assembler.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.