当前位置: 技术问答>linux和unix
ld 报undefined reference to `printf'求解决方法
来源: 互联网 发布时间:2017-01-16
本文导语: .section .data output: .asciz "Tis is a section %dn" .section .text .globl _start _start: pushl $1 pushl $output call printf add $8, %esp call ...
.section .data
output:
.asciz "Tis is a section %dn"
.section .text
.globl _start
_start:
pushl $1
pushl $output
call printf
add $8, %esp
call overhere
pushl $3
pushl $output
call printf
add $8, %esp
pushl $0
call exit
overhere:
pushl %ebp
movl %esp, %ebp
pushl $2
pushl $output
call printf
add $8, %esp
movl %ebp, %esp
popl %ebp
ret
output:
.asciz "Tis is a section %dn"
.section .text
.globl _start
_start:
pushl $1
pushl $output
call printf
add $8, %esp
call overhere
pushl $3
pushl $output
call printf
add $8, %esp
pushl $0
call exit
overhere:
pushl %ebp
movl %esp, %ebp
pushl $2
pushl $output
call printf
add $8, %esp
movl %ebp, %esp
popl %ebp
ret
|
如果是驱动,换成printk
应用程序的话#include
应用程序的话#include