Skip navigation

some bug in xcode's non gnu arm assembler.

301 Views 0 Replies Latest reply: Nov 14, 2012 12:22 PM by banxian RSS
banxian Calculating status...
Currently Being Moderated
Nov 14, 2012 12:22 PM

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

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.