Compiling Opus 1.1-rc2 for iOS with XCode 5 - ios

I'm trying to compile Opus 1.1-rc2 with ARM NEON optimizations for iOS.
Here is the configure that I am using :
export CC="xcrun -sdk iphoneos clang -arch armv7"
export CCAS="xcrun -sdk iphoneos clang -arch armv7 -no-integrated-as"
./configure --enable-fixed-point \
--disable-doc \
--disable-extra-programs \
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk \
--host=arm-apple-darwin
If I use --disable-asm, everything compiles gloriously :) But I do want the ARM NEON optimizations, so I don't want to put the flag. And here come the troubles :
Without -no-integrated-as, I get:
libtool: compile: xcrun -sdk iphoneos clang -arch armv7 -DHAVE_CONFIG_H -I. -I../../../opus-1.1-rc -I../../../opus-1.1-rc/include -I../../../opus-1.1-rc/celt -I../../../opus-1.1-rc/silk -I../../../opus-1.1-rc/silk/float -I../../../opus-1.1-rc/silk/fixed -g -O2 -MT celt/arm/celt_pitch_xcorr_arm-gnu.lo -MD -MP -MF celt/arm/.deps/celt_pitch_xcorr_arm-gnu.Tpo -c celt/arm/celt_pitch_xcorr_arm-gnu.S -fno-common -DPIC -o celt/arm/.libs/celt_pitch_xcorr_arm-gnu.o
celt/arm/celt_pitch_xcorr_arm-gnu.S:29:24: error: unknown directive
.text; .p2align 2; .arch armv7-a
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:30:4: error: unknown directive
.fpu neon
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:31:4: error: unknown directive
.object_arch armv4t
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:255:2: error: unknown directive
.type xcorr_kernel_neon, %function; xcorr_kernel_neon: # PROC
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:316:2: error: unknown directive
.size xcorr_kernel_neon, .-xcorr_kernel_neon # ENDP
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:318:2: error: unknown directive
.type celt_pitch_xcorr_neon, %function; celt_pitch_xcorr_neon: # PROC
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:362:14: error: invalid variant ''
CMP r8, r4#
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:405:2: error: unknown directive
.size celt_pitch_xcorr_neon, .-celt_pitch_xcorr_neon # ENDP
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:414:2: error: unknown directive
.type xcorr_kernel_edsp, %function; xcorr_kernel_edsp: # PROC
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:466:3: error: invalid instruction
LDRGTH r14, [r4], #2 # r14 = *x++
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:476:3: error: invalid instruction
LDRGTH r12, [r4], #2 # r12 = *x++
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:484:3: error: invalid instruction
LDRGTH r14, [r4] # r14 = *x
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:494:2: error: unknown directive
.size xcorr_kernel_edsp, .-xcorr_kernel_edsp # ENDP
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:496:2: error: unknown directive
.type celt_pitch_xcorr_edsp, %function; celt_pitch_xcorr_edsp: # PROC
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:577:3: error: invalid instruction
LDRGEH r6, [r4], #2
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:578:3: error: invalid instruction
LDRGEH r8, [r5], #2
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:596:2: error: unknown directive
.size celt_pitch_xcorr_edsp, .-celt_pitch_xcorr_edsp # ENDP
^
celt/arm/celt_pitch_xcorr_arm-gnu.S:601:23: error: unexpected token in '.section' directive
.section .note.GNU-stack,"",%progbits
^
With -no-integrated-as, I get:
libtool: compile: xcrun -sdk iphoneos clang -arch armv7 -no-integrated-as -DHAVE_CONFIG_H -I. -I../../../opus-1.1-rc -I../../../opus-1.1-rc/include -I../../../opus-1.1-rc/celt -I../../../opus-1.1-rc/silk -I../../../opus-1.1-rc/silk/float -I../../../opus-1.1-rc/silk/fixed -g -O2 -MT celt/arm/celt_pitch_xcorr_arm-gnu.lo -MD -MP -MF celt/arm/.deps/celt_pitch_xcorr_arm-gnu.Tpo -c celt/arm/celt_pitch_xcorr_arm-gnu.S -fno-common -DPIC -o celt/arm/.libs/celt_pitch_xcorr_arm-gnu.o
celt/arm/celt_pitch_xcorr_arm-gnu.S:29:Unknown pseudo-op: .arch
celt/arm/celt_pitch_xcorr_arm-gnu.S:29:Rest of line ignored. 1st junk character valued 97 (a).
celt/arm/celt_pitch_xcorr_arm-gnu.S:30:Unknown pseudo-op: .fpu
celt/arm/celt_pitch_xcorr_arm-gnu.S:30:Rest of line ignored. 1st junk character valued 110 (n).
celt/arm/celt_pitch_xcorr_arm-gnu.S:31:Unknown pseudo-op: .object_arch
celt/arm/celt_pitch_xcorr_arm-gnu.S:31:Rest of line ignored. 1st junk character valued 97 (a).
celt/arm/celt_pitch_xcorr_arm-gnu.S:36:Unknown pseudo-op: .global
celt/arm/celt_pitch_xcorr_arm-gnu.S:36:Rest of line ignored. 1st junk character valued 99 (c).
celt/arm/celt_pitch_xcorr_arm-gnu.S:40:Unknown pseudo-op: .global
celt/arm/celt_pitch_xcorr_arm-gnu.S:40:Rest of line ignored. 1st junk character valued 99 (c).
celt/arm/celt_pitch_xcorr_arm-gnu.S:255:Unknown pseudo-op: .type
celt/arm/celt_pitch_xcorr_arm-gnu.S:255:Rest of line ignored. 1st junk character valued 120 (x).
celt/arm/celt_pitch_xcorr_arm-gnu.S:273:bad instruction `VLD1.16 {d3},[r1]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:274:bad instruction `SUB r3,r2,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:275:bad instruction `MOVS r3,r3,lsr#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:276:bad instruction `BEQ xcorr_kernel_neon_process4_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:281:bad instruction `SUBS r3,r3,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:282:bad instruction `VLD1.16 d4,[r1]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:283:bad instruction `VLD1.16 d2,[r0]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:284:bad instruction `VEXT.16 d5,d3,d4,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:285:bad instruction `VEXT.16 d6,d3,d4,#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:286:bad instruction `VEXT.16 d7,d3,d4,#3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:288:bad instruction `VMLAL.S16 q0,d3,d2[0]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:289:bad instruction `VMLAL.S16 q0,d5,d2[1]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:290:bad instruction `VMLAL.S16 q0,d6,d2[2]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:291:bad instruction `VMLAL.S16 q0,d7,d2[3]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:293:bad instruction `VMOV.S16 d3,d4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:295:bad instruction `BNE xcorr_kernel_neon_process4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:299:bad instruction `VLD1.16 {d2[]},[r0]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:301:bad instruction `SUB r3,r2,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:302:bad instruction `ANDS r3,r3,#3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:303:bad instruction `VMLAL.S16 q0,d3,d2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:304:bad instruction `BEQ xcorr_kernel_neon_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:307:bad instruction `SUBS r3,r3,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:308:bad instruction `VLD1.16 {d4[]},[r1]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:309:bad instruction `VLD1.16 {d2[]},[r0]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:310:bad instruction `VEXT.16 d3,d3,d4,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:311:bad instruction `VMLAL.S16 q0,d3,d2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:312:bad instruction `BNE xcorr_kernel_neon_process_remaining'
celt/arm/celt_pitch_xcorr_arm-gnu.S:315:bad instruction `MOV pc,lr'
celt/arm/celt_pitch_xcorr_arm-gnu.S:316:Unknown pseudo-op: .size
celt/arm/celt_pitch_xcorr_arm-gnu.S:316:Rest of line ignored. 1st junk character valued 120 (x).
celt/arm/celt_pitch_xcorr_arm-gnu.S:318:Unknown pseudo-op: .type
celt/arm/celt_pitch_xcorr_arm-gnu.S:318:Rest of line ignored. 1st junk character valued 99 (c).
celt/arm/celt_pitch_xcorr_arm-gnu.S:328:bad instruction `STMFD sp!,{r4-r9,lr}'
celt/arm/celt_pitch_xcorr_arm-gnu.S:330:bad instruction `LDR r4,[sp,#28]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:331:bad instruction `MOV r5,r0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:332:bad instruction `MOV r6,r1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:333:bad instruction `MOV r7,r2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:334:bad instruction `MOV r2,r3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:336:bad instruction `VMOV.S32 d16,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:337:bad instruction `MOV r8,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:338:bad instruction `CMP r4,#3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:339:bad instruction `BLE celt_pitch_xcorr_neon_process4_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:341:bad instruction `SUB r9,r4,#3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:344:bad instruction `MOV r0,r5'
celt/arm/celt_pitch_xcorr_arm-gnu.S:345:bad instruction `ADD r1,r6,r8,LSL#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:346:bad instruction `VMOV.I32 q0,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:350:bad instruction `BL xcorr_kernel_neon'
celt/arm/celt_pitch_xcorr_arm-gnu.S:352:bad instruction `VST1.32 {q0},[r7]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:353:bad instruction `VPMAX.S32 d0,d0,d1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:354:bad instruction `ADD r8,r8,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:355:bad instruction `VPMAX.S32 d0,d0,d0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:356:bad instruction `CMP r8,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:357:bad instruction `VMAX.S32 d16,d16,d0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:359:bad instruction `BLT celt_pitch_xcorr_neon_process4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:362:bad instruction `CMP r8,r4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:363:bad instruction `BGE celt_pitch_xcorr_neon_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:366:bad instruction `MOV r0,r5'
celt/arm/celt_pitch_xcorr_arm-gnu.S:367:bad instruction `ADD r1,r6,r8,LSL#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:368:bad instruction `VMOV.I32 q0,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:369:bad instruction `MOVS r3,r2,LSR#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:370:bad instruction `BEQ inner_loop_neon_process4_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:373:bad instruction `VLD1.16 {d2},[r0]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:374:bad instruction `VLD1.16 {d3},[r1]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:375:bad instruction `SUBS r3,r3,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:376:bad instruction `VMLAL.S16 q0,d2,d3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:377:bad instruction `BNE inner_loop_neon_process4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:379:bad instruction `VPADD.S32 d0,d0,d1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:380:bad instruction `VPADD.S32 d0,d0,d0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:383:bad instruction `ANDS r3,r2,#3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:384:bad instruction `BEQ inner_loop_neon_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:387:bad instruction `VLD1.16 {d2[]},[r0]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:388:bad instruction `VLD1.16 {d3[]},[r1]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:389:bad instruction `SUBS r3,r3,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:390:bad instruction `VMLAL.S16 q0,d2,d3'
celt/arm/celt_pitch_xcorr_arm-gnu.S:391:bad instruction `BNE inner_loop_neon_process_remaining'
celt/arm/celt_pitch_xcorr_arm-gnu.S:394:bad instruction `VST1.32 {d0[0]},[r7]!'
celt/arm/celt_pitch_xcorr_arm-gnu.S:395:bad instruction `VMAX.S32 d16,d16,d0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:397:bad instruction `ADD r8,r8,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:398:bad instruction `CMP r8,r4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:399:bad instruction `BCC celt_pitch_xcorr_neon_process_remaining'
celt/arm/celt_pitch_xcorr_arm-gnu.S:402:bad instruction `VMOV d0,d16'
celt/arm/celt_pitch_xcorr_arm-gnu.S:403:bad instruction `VMOV.32 r0,d0[0]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:404:bad instruction `LDMFD sp!,{r4-r9,pc}'
celt/arm/celt_pitch_xcorr_arm-gnu.S:405:Unknown pseudo-op: .size
celt/arm/celt_pitch_xcorr_arm-gnu.S:405:Rest of line ignored. 1st junk character valued 99 (c).
celt/arm/celt_pitch_xcorr_arm-gnu.S:414:Unknown pseudo-op: .type
celt/arm/celt_pitch_xcorr_arm-gnu.S:414:Rest of line ignored. 1st junk character valued 120 (x).
celt/arm/celt_pitch_xcorr_arm-gnu.S:427:bad instruction `STMFD sp!,{r2,r4,r5,lr}'
celt/arm/celt_pitch_xcorr_arm-gnu.S:428:bad instruction `SUBS r2,r3,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:429:bad instruction `LDRD r10,r11,[r5],#8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:430:bad instruction `BLE xcorr_kernel_edsp_process4_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:431:bad instruction `LDR r12,[r4],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:437:bad instruction `SMLABB r6,r12,r10,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:438:bad instruction `LDR r14,[r4],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:439:bad instruction `SMLABT r7,r12,r10,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:440:bad instruction `SUBS r2,r2,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:441:bad instruction `SMLABB r8,r12,r11,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:442:bad instruction `SMLABT r9,r12,r11,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:443:bad instruction `SMLATT r6,r12,r10,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:444:bad instruction `LDR r10,[r5],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:445:bad instruction `SMLATB r7,r12,r11,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:446:bad instruction `SMLATT r8,r12,r11,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:447:bad instruction `SMLATB r9,r12,r10,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:448:bad instruction `LDRGT r12,[r4],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:449:bad instruction `SMLABB r6,r14,r11,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:450:bad instruction `SMLABT r7,r14,r11,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:451:bad instruction `SMLABB r8,r14,r10,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:452:bad instruction `SMLABT r9,r14,r10,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:453:bad instruction `SMLATT r6,r14,r11,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:454:bad instruction `LDR r11,[r5],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:455:bad instruction `SMLATB r7,r14,r10,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:456:bad instruction `SMLATT r8,r14,r10,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:457:bad instruction `SMLATB r9,r14,r11,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:458:bad instruction `BGT xcorr_kernel_edsp_process4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:460:bad instruction `ADDS r2,r2,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:461:bad instruction `BLE xcorr_kernel_edsp_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:462:bad instruction `LDRH r12,[r4],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:463:bad instruction `SUBS r2,r2,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:465:bad instruction `SMLABB r6,r12,r10,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:466:bad instruction `LDRGTH r14,[r4],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:467:bad instruction `SMLABT r7,r12,r10,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:468:bad instruction `SMLABB r8,r12,r11,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:469:bad instruction `SMLABT r9,r12,r11,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:470:bad instruction `BLE xcorr_kernel_edsp_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:471:bad instruction `SMLABT r6,r14,r10,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:472:bad instruction `SUBS r2,r2,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:473:bad instruction `SMLABB r7,r14,r11,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:474:bad instruction `LDRH r10,[r5],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:475:bad instruction `SMLABT r8,r14,r11,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:476:bad instruction `LDRGTH r12,[r4],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:477:bad instruction `SMLABB r9,r14,r10,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:478:bad instruction `BLE xcorr_kernel_edsp_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:479:bad instruction `SMLABB r6,r12,r11,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:480:bad instruction `CMP r2,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:481:bad instruction `SMLABT r7,r12,r11,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:482:bad instruction `LDRH r2,[r5],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:483:bad instruction `SMLABB r8,r12,r10,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:484:bad instruction `LDRGTH r14,[r4]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:485:bad instruction `SMLABB r9,r12,r2,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:486:bad instruction `BLE xcorr_kernel_edsp_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:487:bad instruction `SMLABT r6,r14,r11,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:488:bad instruction `LDRH r11,[r5]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:489:bad instruction `SMLABB r7,r14,r10,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:490:bad instruction `SMLABB r8,r14,r2,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:491:bad instruction `SMLABB r9,r14,r11,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:493:bad instruction `LDMFD sp!,{r2,r4,r5,pc}'
celt/arm/celt_pitch_xcorr_arm-gnu.S:494:Unknown pseudo-op: .size
celt/arm/celt_pitch_xcorr_arm-gnu.S:494:Rest of line ignored. 1st junk character valued 120 (x).
celt/arm/celt_pitch_xcorr_arm-gnu.S:496:Unknown pseudo-op: .type
celt/arm/celt_pitch_xcorr_arm-gnu.S:496:Rest of line ignored. 1st junk character valued 99 (c).
celt/arm/celt_pitch_xcorr_arm-gnu.S:513:bad instruction `STMFD sp!,{r4-r11,lr}'
celt/arm/celt_pitch_xcorr_arm-gnu.S:514:bad instruction `MOV r5,r1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:515:bad instruction `LDR r1,[sp,#36]'
celt/arm/celt_pitch_xcorr_arm-gnu.S:516:bad instruction `MOV r4,r0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:518:bad instruction `MOV r0,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:520:bad instruction `SUBS r1,r1,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:521:bad instruction `BLT celt_pitch_xcorr_edsp_process4_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:525:bad instruction `MOV r6,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:526:bad instruction `MOV r7,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:527:bad instruction `MOV r8,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:528:bad instruction `MOV r9,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:529:bad instruction `BL xcorr_kernel_edsp'
celt/arm/celt_pitch_xcorr_arm-gnu.S:531:bad instruction `CMP r0,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:533:bad instruction `ADD r5,r5,#8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:534:bad instruction `MOVLT r0,r6'
celt/arm/celt_pitch_xcorr_arm-gnu.S:535:bad instruction `CMP r0,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:536:bad instruction `STRD r6,r7,[r2],#8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:537:bad instruction `MOVLT r0,r7'
celt/arm/celt_pitch_xcorr_arm-gnu.S:538:bad instruction `CMP r0,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:539:bad instruction `STRD r8,r9,[r2],#8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:540:bad instruction `MOVLT r0,r8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:541:bad instruction `CMP r0,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:542:bad instruction `MOVLT r0,r9'
celt/arm/celt_pitch_xcorr_arm-gnu.S:543:bad instruction `SUBS r1,r1,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:544:bad instruction `BGE celt_pitch_xcorr_edsp_process4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:546:bad instruction `ADDS r1,r1,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:547:bad instruction `BLE celt_pitch_xcorr_edsp_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:550:bad instruction `SUBS r12,r3,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:552:bad instruction `MOV r14,#0'
celt/arm/celt_pitch_xcorr_arm-gnu.S:553:bad instruction `BLT celt_pitch_xcorr_edsp_process_remaining_loop_done'
celt/arm/celt_pitch_xcorr_arm-gnu.S:554:bad instruction `LDRD r6,r7,[r4],#8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:555:bad instruction `LDRD r8,r9,[r5],#8'
celt/arm/celt_pitch_xcorr_arm-gnu.S:558:bad instruction `SMLABB r14,r6,r8,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:559:bad instruction `SUBS r12,r12,#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:560:bad instruction `SMLATT r14,r6,r8,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:561:bad instruction `LDRGE r6,[r4],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:562:bad instruction `SMLABB r14,r7,r9,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:563:bad instruction `LDRGE r8,[r5],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:564:bad instruction `SMLATT r14,r7,r9,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:565:bad instruction `LDRGE r7,[r4],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:566:bad instruction `LDRGE r9,[r5],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:567:bad instruction `BGE celt_pitch_xcorr_edsp_process_remaining_loop4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:569:bad instruction `ADDS r12,r12,#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:570:bad instruction `LDRGE r6,[r4],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:571:bad instruction `LDRGE r8,[r5],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:573:bad instruction `SMLABBGE r14,r6,r8,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:574:bad instruction `SUBGE r12,r12,#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:575:bad instruction `SMLATTGE r14,r6,r8,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:576:bad instruction `ADDS r12,r12,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:577:bad instruction `LDRGEH r6,[r4],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:578:bad instruction `LDRGEH r8,[r5],#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:580:bad instruction `SUB r4,r4,r3,LSL#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:582:bad instruction `SMLABBGE r14,r6,r8,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:584:bad instruction `SUB r5,r5,r3,LSL#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:587:bad instruction `CMP r0,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:588:bad instruction `ADD r5,r5,#2'
celt/arm/celt_pitch_xcorr_arm-gnu.S:589:bad instruction `MOVLT r0,r14'
celt/arm/celt_pitch_xcorr_arm-gnu.S:590:bad instruction `SUBS r1,r1,#1'
celt/arm/celt_pitch_xcorr_arm-gnu.S:592:bad instruction `STR r14,[r2],#4'
celt/arm/celt_pitch_xcorr_arm-gnu.S:593:bad instruction `BGT celt_pitch_xcorr_edsp_process_remaining'
celt/arm/celt_pitch_xcorr_arm-gnu.S:595:bad instruction `LDMFD sp!,{r4-r11,pc}'
celt/arm/celt_pitch_xcorr_arm-gnu.S:596:Unknown pseudo-op: .size
celt/arm/celt_pitch_xcorr_arm-gnu.S:596:Rest of line ignored. 1st junk character valued 99 (c).
celt/arm/celt_pitch_xcorr_arm-gnu.S:601:unknown section type: %progbits
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
So what should I do to compile Opus with ASM NEON optimizations for iOS ?
(BTW, compiling Opus with ASM Neon optims for Android was very easy and straightforward)

There are known build issues with the new Neon assembly. For now, the best thing to do in case of problem is to configure with --disable-rtcd.

Looking at the non-integrated assembly errors (and the -gnu filename), I'd say this was written for gas rather than llvm, which is why you're probably compiling fine for Android (you're probably using gas there, aren't you?)
I'd recommend trying the gas-preprocessor.pl script to convert this code first. It's designed to convert the ffmpeg code to work with Apple's old gas assembler, so it will probably get it closer to where you need for LLVM. You may still need to go through and lowercase the instructions, though.
You could also try compiling this with GCC into a static library. You could also google for "opus ios." It looks like others have attacked this problem (not sure if that script actually works for this, but it's a start).

Related

NASM example throws memory violation

I am new to NASM assembler, and would like to just compile a small example.
global _start
section .text
_start:
mov EAX,1
Compiling it with
$ nasm -f elf64 code.asm ; ld code.o ; ./a.out
Naruszenie ochrony pamięci (zrzut pamięci)
Building works fine but running yields memory access violation.

How can I compile iOS ARM assembly code from the command line?

I'm trying to compile an iOS project that contains ARM code using the command line.
Here is the command line:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as -arch armv6 engines/scumm/smush/codec47ARM.s -o engines/scumm/smush/codec47ARM.o
...and here are the errors:
engines/scumm/smush/codec47ARM.s:29:Unknown pseudo-op: .global
engines/scumm/smush/codec47ARM.s:29:Rest of line ignored. 1st junk character valued 95 (_).
engines/scumm/smush/codec47ARM.s:43:bad instruction `STMFD r13!,{r2,r4-r11,R14}'
engines/scumm/smush/codec47ARM.s:45:bad instruction `LDR r4,[r13,#40]'
engines/scumm/smush/codec47ARM.s:48:bad instruction `SUB r4,r4,#0xF8'
engines/scumm/smush/codec47ARM.s:55:bad instruction `ADD r7,r2,#7'
engines/scumm/smush/codec47ARM.s:56:bad instruction `MOV r7,r7,LSR#3'
If I try to compile with gcc (or clang), I receive the following errors:
engines/scumm/smush/codec47ARM.s:162:2: error: invalid instruction
LDREQB r6,[r1],#1 # r6 = t = *_d_src++
^
engines/scumm/smush/codec47ARM.s:279:2: error: invalid instruction
LDREQB r6,[r1],#1 # r6 = t = *_d_src++
^
engines/scumm/smush/codec47ARM.s:330:2: error: invalid instruction
LDRLTB r6,[r4,r6] # r6 = t = _paramPtr[code]
^
What am I doing wrong? I believe that ARMv6 should support MOV, ADD, etc.

Building a C library (GMP) for arm64 iOS

I'm trying to build a C library (GMP 6.0.0) for arm64 for use on iOS. I'm running the configure script with the invocation below (compiler is as found using xcrun --find).
./configure \
CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" \
CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" \
CPPFLAGS="-target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0" \
--host=aarch64-apple-darwin
However this fails at the following line ("long long reliability test 1"):
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -O2 -pedantic -target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0... no, long long reliability test 1
configure: error: could not find a working compiler, see config.log for details
Full config.log available here. It shows multiple warning and errors for the long long reliability test compile, including the following:
conftest.c:9:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
^
conftest.c:10:44: error: implicit declaration of function 'h' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:48: error: implicit declaration of function 'g' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:100: warning: control reaches end of non-void function [-Wreturn-type]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
Using --host=none it works fine, but I'd really like to figure out how to build it with assembly optimized for arm64.
My system is x86_64-apple-darwin13.1.0 (or coreisbr-apple-darwin13.1.0 according to config.guess), an early '11 Core i7 MBP running OS X v10.9.2. I'm using Xcode 5.1 (5B130a).
Any help appreciated.
EDIT 1
Compiling for ARMv7 passes configure, but fails on make (full configure/make output here), apparently while compiling some assembly:
tmp-dive_1.s:165:18: error: unexpected token in '.section' directive
.section .rodata
^
EDIT 2
#MarcGlisse: By forcing clang to ignore the errors as suggested (-Wno-...) arm64 passes configure, but then fails on make (full output here):
tmp-mul_1.s:59:2: error: unrecognized instruction mnemonic
bcc Lfi1
^
tmp-mul_1.s:60:2: error: unrecognized instruction mnemonic
beq Lfi2
^
As a side note: these commits, I assume intended to remove the need for suppressing the error, don't seem to work i.e. I get the same error when removing the supression.
For armv7, using these commits as suggested fixes the .section error, but make fails later on with the following (full output here):
tmp-mode1o.s:64:2: error: unknown directive
.protected ___gmp_binvert_limb_table
^
EDIT 3
Using the suggested edits, armv7, armv7s, i386 and x86_64 now all compile with assembly!
For arm64 the edits get it past the previous error, but now gives several errors about an invalid input constraint 'rZ', all in the same file (full output here):
divrem_1.c:237:5: error: invalid input constraint 'rZ' in asm
udiv_qrnnd_preinv (*qp, r, r, nshift, d, dinv);
^
../gmp-impl.h:3062:2: note: expanded from macro 'udiv_qrnnd_preinv'
add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
^
../longlong.h:551:7: note: expanded from macro 'add_ssaaaa'
: "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
EDIT 4
After commenting out add_ssaaaa and sub_ddmmss in longlong.h and editing some more assembly instructions in gcd_1.asm (blo to b.lo etc.), it now fails with several of the following errors (full output here):
tmp-invert_limb.s:75:22: error: immediate value expected for shifter operand
add x1, x1, x2, lsr 1
^
tmp-invert_limb.s:75:22: error: invalid operand for instruction
add x1, x1, x2, lsr 1
^
I'll post a total diff later.
EDIT 5
Ok, that gets us another step further, but it now hits into (full output here):
tmp-invert_limb.s:52:2: error: ADR/ADRP relocations must be GOT relative
adrp x1, approx_tab
^
If this keeps going it might be better to continue this via email.
"Support for ARM64 alias Aarch64 alias ARMv8"
https://gmplib.org/gmp6.0
Copyright issues aside...
GMP may not be compatible with Apple's proprietary CPU, and may not be compatible with Clang/LLVM. Being a GNU project it is probably more thoroughly tested with GCC on non-proprietary chipsets.
A quick search shows historically at least there have been issues compiling GMP with clang.
You really should email the GMP community and ask for help on this one.

Error while build ffmpeg for iOS

I'm trying to build fmmpeg for iOS with the following config:
./configure --prefix=build/armv7 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avutil --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" --target-os=darwin --cc=gcc --extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=6.0" --extra-ldflags="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=6.0" --arch=arm --cpu=cortex-a9 --enable-pic
when i try to make it i'm receiving the follow error:
AS libavcodec/arm/vc1dsp_neon.o
libavcodec/arm/vc1dsp_neon.S:751:10: error: unexpected token in argument list
ra .dn d28.i8
^
libavcodec/arm/vc1dsp_neon.S:752:10: error: unexpected token in argument list
rb .dn d29.i8
^
libavcodec/arm/vc1dsp_neon.S:753:10: error: unexpected token in argument list
rc .dn d30.i8
^
libavcodec/arm/vc1dsp_neon.S:754:10: error: unexpected token in argument list
rd .dn d31.i8
^
libavcodec/arm/vc1dsp_neon.S:757:14: error: invalid operand for instruction
vmov ra, #4
^
libavcodec/arm/vc1dsp_neon.S:758:14: error: invalid operand for instruction
vmov rb, #53
^
libavcodec/arm/vc1dsp_neon.S:759:14: error: invalid operand for instruction
vmov rc, #18
^
libavcodec/arm/vc1dsp_neon.S:760:14: error: invalid operand for instruction
vmov rd, #3
^
libavcodec/arm/vc1dsp_neon.S:864:10: error: unexpected token in argument list
ra .dn d28.i16
^
libavcodec/arm/vc1dsp_neon.S:865:10: error: unexpected token in argument list
rb .dn d29.i16
^
what could be the error?
Try adding the flags --disable-neon and --disable-armv5te.
BTW, the following set of flags does the trick for AMRv7:
'--arch=arm',
'--enable-pic',
"--extra-cflags='-arch armv7 -miphoneos-version-min=6.0'",
"--extra-ldflags='-arch armv7 -miphoneos-version-min=6.0'",
'--disable-neon',
'--enable-optimizations',
'--disable-debug',
'--disable-armv5te',
'--disable-armv6',
'--disable-armv6t2',
'--disable-ffmpeg',
'--disable-ffplay',
'--disable-ffserver',
'--disable-ffprobe',
'--disable-doc',
'--disable-bzlib',
'--target-os=darwin',
'--enable-cross-compile',
'--enable-version3',
Or, event better, you change the version of gas-preprocessor you have to the libAV maintained version: https://github.com/libav/gas-preprocessor
Hope this helps.

Compiling x264 for iOS 7

I'm getting error on compiling x264 for iOS.
I have Xcode Version 5.0 (5A1413) with Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn). I'm compiling x264-snapshot-20130925-2245.
Config:
CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang ./configure \
--host=arm-apple-darwin \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk \
--prefix=armv7 \
--extra-cflags='-arch armv7' \
--extra-ldflags="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/system -arch armv7" \
--enable-pic \
--enable-static
Getting error:
common/arm/cpu-a.S:29:7: error: unknown token in expression
.align
^
common/arm/cpu-a.S:139:5: error: instruction 'suble' can not set flags, but 's' suffix specified
subles ip, ip, #1
^
The relevant change in the Xcode 5 toolchain is that the LLVM compiler now defaults to using the built-in assembler, and the built-in assembler requires more strict adherence to the ARM Unified Assembly Language.
There are two ways to get it to compile with the Xcode 5 toolchain:
Give clang the flag -no-integrated-as. Adding it to --extra-cflags ought to work. (The flag worked for me compiling individual files but I never worked it into configure.) Consider this a workaround.
Fix the assembly source code in x264's common/arm subdirectory. This is pretty easy actually, and it's what I did. This is the right fix. BTW, I'm about to submit a patch to x264 with these changes.
The assembler emits many errors and they fall into four categories:
In cpu-a.S, the ".align" directive should be ".align 2". (Apparently it used to default to 2, now the 2 must be explicit.)
Several subles and sublts instructions in multiple files. These are variants of "sub" (subtract), followed by a condition (2 characters) and the "s" suffix. Now the "s" has to precede the condition. Thus "subles" => "subsle" and "sublts" => "subslt".
A fair number of ldrd instructions in various files. This instruction means "load register, double (from memory)". It loads 2 32-bit words from memory into registers. It used to be OK to name only the first register; now both need to be named. They're always adjacent. So "ldrd r2, whatever" needs to become "ldrd r2, r3, whatever". "ldrd r6, something" becomes "ldrd r6, r7, something". Etc.
In pixel-a.S, there's an instruction "vmov.32 r0, r1, d0". This is incorrect. vmov.32 means move a 32-bit quantity, yet the arguments say to move d0 (64 bits) into r0 and r1. Apparently the old compiler took the ".32" part as a hint. I believe it should be "vmov r0, r1, d0" and that change works for me - but I don't have absolute proof that is the correct instruction.
Many thanks to gparker on the Apple Developer Forum! I could not have figured this out without his/her help. Link to forum discussion, Apple ID required.
So far the only solution seems to be --disable-asm.
I think disabling assembler optimizations is a bad solution.
After a long research I've found the root of the problem: clang during assembler compilation uses ASFLAGS not CFLAGS, so adding --extra-asflags="-arch armv7" solves the problem
./configure \
--host=arm-apple-darwin \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
--prefix=armv7 \
--extra-cflags="-arch armv7" \
--extra-asflags="-arch armv7" \
--extra-ldflags="-arch armv7" \
--enable-pic \
--enable-static
NOTE: For bitcode support just add -fembed-bitcode to all extra flags parameters

Resources