Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: unexpected token in '.section' directive .section .text

when I compile assembly 'xx.s' in xcode and there are some errors "error: unexpected token in '.section' directive .section .text " in xx.s the code is below:

.section .text

.global PreMDCT

PreMDCT:

stmdb     sp!, {r4 - r11, lr}

add         r9, r0, r1, lsl #2

sub         r3, r9, #32

movs        r1, r1, asr #2

beq         PreMDCT_END

.end

thanks

like image 533
user2117892 Avatar asked Feb 18 '23 08:02

user2117892


1 Answers

While that is valid gcc / as code, it might not be valid xcode syntax.

The xcode devoloper manual suggests that .text is a directive of its own and it's the first implicit directive. Thus it may works simply with

.text
.global asdf
asdf:
        nop
        ret
.end

or even without the first directive.

like image 103
Aki Suihkonen Avatar answered Mar 03 '23 14:03

Aki Suihkonen