错误:ARM的-as和-o错误在行末 [英] Error: Junk at end of line -as and -o error with ARM

查看:46
本文介绍了错误:ARM的-as和-o错误在行末的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写我的第一个ARM程序,并在尝试运行时遇到此错误为-o labl1.o lab1.s"

I am attempting to write my first ARM program and getting this error when I try to run "as -o labl1.o lab1.s"

lab1.s:3: Error: junk at end of line, first unrecognized character is `s'

我不确定我在这里做错了什么,因为我唯一使用s的时候是在我的2个字符串中,并且很困惑我在哪里出错了.

I am very unsure about what I am doing wrong here, as the only times I use s is in my 2 strings, and very puzzled on where in the code I went wrong.


@Data
.data
string1: .asciz
string2: .asciz

@Code
.text
.global main
.extern printf

main:

push {ip, lr}

push {r0, r1, r2}
ldr r0, =string1
mov r1, #34
mov r2, #56
bl printf
pop {r0,r1,r2}

push {r0}
ldr r0, =string2
bl printf
pop {r0}

pop {ip, pc}

非常感谢您链接到有用的文档或帮助调试!

Links to helpful documents or help debugging would be greatly appreciated, thank you!

推荐答案

您可能会混淆字符串的地址和要为其分配的值:正如在GNU中指定为

You may be confusing the address of your strings and the values you want to assign them: As specified in GNU as documentation, the .asciz directive does require a string argument - a slightly modified version of your code does assemble correctly:

.data
string1: .asciz "string1"
string2: .asciz "string2"

string1 现在是字节"string1 \ x00 "所在地址的标签,而 string2 是地址的标签字节"string2 \ x00" 所在的位置.

string1 is now the label for the address where bytes "string1\x00" are located, and string2 is the label for the address where bytes "string2\x00" are.

这篇关于错误:ARM的-as和-o错误在行末的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆