Question

I am trying to run an assembly file on Mac OS X that uses .string pseudo-ops, which apparently aren't recognized. How should the following lines be replaced so it will work on a mac?

ArrayIndexOutOfBoundsException:
.long 35
.string "Array index out of bounds exception"

The line I am using to execute the assembly file is:

gcc -m32 -g3 runtime.c foo.s -o foo

Where runtime.c is a file with functions that can be invoked by foo.s program.

Was it helpful?

Solution

.asciz, or if you don't have that then whatever you have for ascii text and add a terminating 0 byte manually.

Update: if you have .asciz then just use that in place of .string:

ArrayIndexOutOfBoundsException:
.long 35
.asciz "Array index out of bounds exception"

Otherwise if you have .ascii use something like:

ArrayIndexOutOfBoundsException:
.long 35
.ascii "Array index out of bounds exception"
.byte 0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top