|
发表于 2006-3-4 20:11:05
|
显示全部楼层
将 .section .rodata改为 .section .data即可
Post by zhangqiang
有见地,顶一个
但是我用gcc编了一下
结果是
.file "xyz.c"
.section .rodata
.LC0:
.string "hello,world!"
.globl xyzstring
.data
.align 4
.type xyzstring,@object
.size xyzstring,4
xyzstring:
.long .LC0
.section .rodata
.LC1:
.string "%s\n"
.text
.globl main
.type main,@function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
movl xyzstring, %eax
movb $97, (%eax)
subl $8, %esp
pushl xyzstring
pushl $.LC1
call printf
addl $16, %esp
movl $0, %eax
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
.s文件中本来就是.text啊
我编了之后运行是段错误 |
|