免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5597 | 回复: 1
打印 上一主题 下一主题

[其他] GCC 4.8.0 编译内核失败 [复制链接]

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:58:11
1 [报告]
发表于 2013-09-18 16:24 |显示全部楼层
本帖最后由 arm-linux-gcc 于 2013-09-18 16:30 编辑

估计是编译器的eabi问题吧,整数除法的相关api是在arch/arm/lib/lib1funcs.S中实现的
你用的编译器用了__aeabi_uldivmod,但是内核中没有实现这个api
你可以试试编译一个hello world,也用和你驱动里一样的除法,采用静态链接,加上CFLAGS -mfloat-abi=soft,然后反汇编看看__aeabi_uldivmod是怎么实现的,然后把代码拷贝到过来

我在最新的3.11内核中,发现没有__aeabi_uldivmod这东西,只有__aeabi_uidivmod
或者直接拷贝一份内核中的__aeabi_uidivmod,再把名字改成__aeabi_uldivmod
arm里面unsigned int和unsigned long应该是一样的


或者是你的驱动里面,算除法时定义的变量是ul型的?改成ui型试试呢?

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:58:11
2 [报告]
发表于 2013-09-18 22:30 |显示全部楼层
编译一个用例如下

int main(int argc, char **argv)
{
        unsigned long a, b, c;
        unsigned int d, e, f;

        c = a / b;
        f = d / e;

        return 1;
}


arm-none-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a9 -mfpu=vfp3 -mfloat-abi=soft div.c -o div-arm-soft

4.6.3的arm-none-linux-gnueabi-gcc编译,反汇编结果如下:
0000842c <main>:
    842c:       e92d4800        push    {fp, lr}
    8430:       e28db004        add     fp, sp, #4
    8434:       e24dd020        sub     sp, sp, #32
    8438:       e50b0020        str     r0, [fp, #-32]  ; 0xffffffe0
    843c:       e50b1024        str     r1, [fp, #-36]  ; 0xffffffdc
    8440:       e51b0008        ldr     r0, [fp, #-8]
    8444:       e51b100c        ldr     r1, [fp, #-12]
    8448:       eb00000a        bl      8478 <__aeabi_uidiv>
    844c:       e1a03000        mov     r3, r0
    8450:       e50b3010        str     r3, [fp, #-16]
    8454:       e51b0014        ldr     r0, [fp, #-20]  ; 0xffffffec
    8458:       e51b1018        ldr     r1, [fp, #-24]  ; 0xffffffe8
    845c:       eb000005        bl      8478 <__aeabi_uidiv>
    8460:       e1a03000        mov     r3, r0
    8464:       e50b301c        str     r3, [fp, #-28]  ; 0xffffffe4
    8468:       e3a03001        mov     r3, #1
    846c:       e1a00003        mov     r0, r3
    8470:       e24bd004        sub     sp, fp, #4
    8474:       e8bd8800        pop     {fp, pc}

可以看到unsigned long和unsigned int的除法,arm-none-linux-gnueabi-gcc都是调的__aeabi_uidiv



我没有4.8的gcc,只能猜测,可能4.8中的unsigned long型的除法是调用的__aeabi_uldiv

所以如果LZ驱动中用的是unsigned long型的话可以尝试改成unsigned int试试
这个问题应该就是4.8的eabi软浮点库对unsigned long和unsigned int型的除法不再一样了,但是内核中又没跟上这种变化,所以导致编译出错

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP