汇编代码里加入一个nop就编译不过了?
代码如下:
[code=Assembly][/code] 2
.section .data
output:
.ascii "The processor Ventor ID is 'xxxxxxxxxxxx'\n"
.section .text
.global _start
_start:
nop
movl $0, %eax
cpuid
movl $output, %edi
movl %ebx, 28(%edi)
movl %edx, 32(%edi)
movl %ecx, 36(%edi)
movl $4, %eax
movl $1, %ebx
movl $output, %ecx
movl $42, %edx
int $0x80
movl $1, %eax
movl $2, %ebx
int $0x80
去掉_start后的nop就正常,加上,在ld的时候就报错:
cpuid.o: In function `_start':
/home/lihacker/workspace/asm/cpuid.s:10: multiple definition of `_start'
cpuid:/home/lihacker/workspace/asm/cpuid.s:10: first defined here
[code=Assembly][/code] 2
.section .data
output:
.ascii "The processor Ventor ID is 'xxxxxxxxxxxx'\n"
.section .text
.global _start
_start:
nop
movl $0, %eax
cpuid
movl $output, %edi
movl %ebx, 28(%edi)
movl %edx, 32(%edi)
movl %ecx, 36(%edi)
movl $4, %eax
movl $1, %ebx
movl $output, %ecx
movl $42, %edx
int $0x80
movl $1, %eax
movl $2, %ebx
int $0x80
去掉_start后的nop就正常,加上,在ld的时候就报错:
cpuid.o: In function `_start':
/home/lihacker/workspace/asm/cpuid.s:10: multiple definition of `_start'
cpuid:/home/lihacker/workspace/asm/cpuid.s:10: first defined here
作者: littleubuntu 发布时间: 2011-01-24
复制你的代码,编译没错
作者: ww2000e 发布时间: 2011-01-25