linux 下at&t语法的汇编之hello world!!

linux 32位汇编(hello world;)
#hello.s
.data  #data 
    msg : .string "Hello ,As Compliner!! Linux\n"
    len = . - msg
.text
.global _start

    _start :
    movl $len, %edx
    movl $msg, %ecx
    movl $1, %ebx
    movl $4, %eax
    int $0x80
    
    movl $0, %ebx
    movl $1, %eax
    int $0x80

  linux 64 位汇编:

#hello.s
.data  #data 
    msg : .string "Hello ,As Compliner!! Linux\n"
    len = . - msg
.text
.global _start

    _start :
    movq $len, %rdx
    movq $msg, %rcx
    movq $1, %rbx
    movq $4, %rax
    int $0x80
    
    movq $0, %rbx
    movq $1, %rax
    int $0x80

  编译 :

$:as -o hello.o hello.s

$:ld -o hello hello.o

$:chmod a+x ./hello

$:./hello

当每天的朝阳洒在我们的脸上,我们要拿什么 来证明自己在这个城市的存在??
原文地址:https://www.cnblogs.com/crazymod/p/2680866.html