连接时出错,(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'

问题

linux@ubuntu:~/jz_2440/led_007_008$ make
arm-none-linux-gnueabi-gcc -c -o led.o led.c
arm-none-linux-gnueabi-gcc -c -o start.o start.s
arm-none-linux-gnueabi-ld -Ttext 0 -g start.o led.o -o led.elf
led.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
make: *** [all] Error 1

解决方法

arm-none-linux-gnueabi-gcc -g -nostdlib -c -o led.o led.c
arm-none-linux-gnueabi-gcc -g -nostdlib -c -o start.o start.s
arm-none-linux-gnueabi-ld -Ttext 0 -g start.o led.o -o led.elf
arm-none-linux-gnueabi-objcopy -O binary -S led.elf led.bin
arm-none-linux-gnueabi-objdump -D led.elf > led.dis

原因

nostdlib就是不使用标准函数库,标准函数库就是编译器中自带的函数库。如果此时我们不想启动编译器自带的函数库,而是用我们自己的代码中的函数时,我们可以用-nostdlib可以让编译器链接器优先选择我程序内自己写的函数库。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值