Skip to content

Instantly share code, notes, and snippets.

@Cyang39
Last active March 2, 2018 21:45
Show Gist options
  • Save Cyang39/bb5c35477d7300e1712b7d54d9d280d9 to your computer and use it in GitHub Desktop.
Save Cyang39/bb5c35477d7300e1712b7d54d9d280d9 to your computer and use it in GitHub Desktop.
汇编语言里的静态数据
# instruction name's sufiix mans data size
# q = 64-bits
# l = 32-bits
# w = 16-bits
# b = 8-bits
# row started with dot is a directive row
.data
x: .quad 0
y: .word 0
z: .double 123.125
name: .string "blah blah\n"
.lcomm buf, 32
.text
movq x, %rax
movw y, %bx
lea name, %rdi
movq $12, %rcx
movb %al, name(%rcx)
# as statdata.s -o statdata.o
# ld statdata.o
# readlf -s a.out
# readlf -S a.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment