相关疑难解决方法(0)

基本程序集在Mac上不起作用(x86_64 + Lion)?

这是代码(exit.s):

.section .data,
.section .text,
.globl _start
_start:
    movl $1, %eax
    movl $32, %ebx
    syscall
Run Code Online (Sandbox Code Playgroud)

当我执行 " as exit.s -o exit.o && ld exit.o -o exit -e _start && ./exit"

返回是"总线错误:10",输出" echo $?"是138

我也在这个问题中尝试了正确答案的例子:Linux 64位中的进程命令行

stil得到"总线错误"......

macos assembly x86-64 system-calls

5
推荐指数
1
解决办法
1411
查看次数

How to get this simple assembly to run?

这是我第一次尝试用汇编编程。我使用的是 64 位 Mac 操作系统。我也在使用 NASM。我已经做了很多寻找解决方案的工作,但我找不到任何适合我的机器的东西。

谁能帮我解决这个问题?这是代码和错误,谢谢!

你好.asm

    global start

    section .text
start:
    mov rax, 1
    mov rdi, 1
    mov rsi, message
    mov rdx, 13
    syscall
    mov eax, 60
    xor rdi, rdi
    syscall
message:
    db "Hello, World", 10  
Run Code Online (Sandbox Code Playgroud)

我尝试执行:

nasm -f macho64 hello.asm -o hello.o
ld -arch i386 -o hello hello.o
./hello
Run Code Online (Sandbox Code Playgroud)

错误

ld: warning: -macosx_version_min not specified, assuming 10.10
ld: warning: ignoring file hello.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 …
Run Code Online (Sandbox Code Playgroud)

macos assembly linker x86-64 nasm

5
推荐指数
1
解决办法
1654
查看次数

标签 统计

assembly ×2

macos ×2

x86-64 ×2

linker ×1

nasm ×1

system-calls ×1