主题 : 关于使用gcc4.3.2-eabi 实现除法指令出现Illegal instruction的问题 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 1563
精华: 0
发帖: 23
金钱: 120 两
威望: 24 点
综合积分: 46 分
注册时间: 2008-09-10
最后登录: 2017-09-13
楼主  发表于: 2010-07-03 17:59

 关于使用gcc4.3.2-eabi 实现除法指令出现Illegal instruction的问题

我使用的硬件为Micro2440开发板
内核    Linux 2.6.32.2 for mini2440/micro2440
工具连  ARM-Linux GCC 4.3.2
编译内核时已打开对eabi 的支持
但是在运行带除法的程序时出现错误提示Illegal instruction
程序如下
#include <stdio.h>
#include <math.h>
int main(void)
{ int i=25,j=4,k;
   char h=6;
   printf("welcome to my rootfs step a! \n");
   k=i /j;
   printf("welcome to my rootfs step b! k=%d \n",k);
   return 0;
}

运行结果如下
welcome to my rootfs step a!
Illegal instruction


但是使用ARM-Linux GCC 3.3.4 编译运用程序时为
welcome to my rootfs step a!
welcome to my rootfs step b! k=8

看汇编指令时发现如下不同
ARM-Linux GCC 4.3.2 下除法为
bl    __aeabi_idiv

ARM-Linux GCC 3.3.4 下除法为
bl    __divsi3

请问是什么问题?
自由,自强,共享,共创。
级别: 论坛版主
UID: 12573
精华: 27
发帖: 8838
金钱: 46490 两
威望: 9298 点
综合积分: 18216 分
注册时间: 2010-01-09
最后登录: 2019-07-16
1楼  发表于: 2010-07-04 15:35
暂时你可以使用4.1.2编译器,我们本月内会更新新版本的软件,将会解决此类问题
新手如何向我们反馈有效的信息,以便解决问题,见此贴:
http://www.arm9home.net/read.php?tid-14431.html

[注]: 此处签名链接仅为指引方向,而非解答问题本身.