免费注册 查看新帖 |

Chinaunix

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

谁能帮我解释一下函数符号导出的问题? [复制链接]

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2015-08-23 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-04-09 10:38 |只看该作者 |倒序浏览
在看软中断的处理函数时我知道先是do_softirq(void),do_softirq(void)完成软中断栈的转换,然后它调用__do_softirq(void),完成实际软中断函数的调用。但我不明白的是linux 2.6.18中有两个do_softirq(void)函数
  1. asmlinkage void do_softirq(void)
  2. {
  3.    .........
  4. //完成软中断栈的切换
  5. if (local_softirq_pending()) {
  6.                 curctx = current_thread_info();
  7.                 irqctx = softirq_ctx[smp_processor_id()];
  8.                 irqctx->tinfo.task = curctx->task;
  9.                 irqctx->tinfo.previous_esp = current_stack_pointer;

  10.                 /* build the stack frame on the softirq stack */
  11.                 isp = (u32*) ((char*)irqctx + sizeof(*irqctx));

  12.                 asm volatile(
  13.                         "       xchgl   %%ebx,%%esp     \n"
  14.                         "       call    __do_softirq    \n"
  15.                         "       movl    %%ebx,%%esp     \n"
  16.                         : "=b"(isp)
  17.                         : "0"(isp)
  18.                         : "memory", "cc", "edx", "ecx", "eax"
  19.                 );
  20. ............
  21. }
复制代码
这一个在arch\i386\kernel.c中
另一个在softirq.c中
  1. asmlinkage void do_softirq(void)
  2. {
  3.         __u32 pending;
  4.         unsigned long flags;

  5.         if (in_interrupt())
  6.                 return;

  7.         local_irq_save(flags);

  8.         pending = local_softirq_pending();

  9.         if (pending)
  10.                 __do_softirq();

  11.         local_irq_restore(flags);
  12. }
复制代码
很明显在调用第1个do_softirq(void)与体系结构有关,但让我不明白的是gcc是怎么编译这两个具有相同函数符号的函数的?
望各位指点指点...先谢谢了!

论坛徽章:
0
2 [报告]
发表于 2012-05-25 12:53 |只看该作者
看看是否编译了两个 .O 文件 在我看来很定只编译一个的!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP