2013年7月18日

摘要: ================================Author: taoyuetaoEmail: tao_yuetao@yahoo.com.cnBlog: taoyuetao.cublog.cn ================================在分析[url=javascript:;]linux[/url]内核时注意到有些函数会有添加__attribute__((unused)),在gcc手册中找到了有关的解释:unused:This attribute, attached to a function, means that the function is mea 阅读全文
posted @ 2013-07-18 17:39 小葫芦藤 阅读(308) 评论(0) 推荐(0)
摘要: 试想这样的情景,程序调用某函数A,A函数存在于两个动态链接库liba.so,libb.so中,并且程序执行需要链接这两个库,此时程序调用的A函数到底是来自于a还是b呢? 这取决于链接时的顺序,比如先链接liba.so,这时候通过liba.so的导出符号表就可以找到函数A的定义,并加入到符号表中,链接libb.so的时候,符号表中已经存在函数A,就不会再更新符号表,所以调用的始终是liba.so中的A函数 这里的调用严重的依赖于链接库加载的顺序,可能会导致混乱;gcc的扩展中有如下属性__attribute__ ((visibility("hidden"))),可以用于抑制将 阅读全文
posted @ 2013-07-18 17:37 小葫芦藤 阅读(1045) 评论(0) 推荐(0)
摘要: 在kernel中有很多__init,这个东东到底是何方神圣捏?且听小生我一一道来。下面是其定义:file:/include/linux/init.h43 #define __init __attribute__ ((__section__ (".init.text"))) __cold44 #define __initdata __attribute__ ((__section__ (".init.data")))45 #define __exitdata __attribute__ ((__section__(".exit.data" 阅读全文
posted @ 2013-07-18 17:29 小葫芦藤 阅读(3928) 评论(0) 推荐(0)
摘要: __FILE__,__LINE__,FUNCTION__实现代码跟踪调试(linux下c语言编程 )先看下简单的初始代码:注意其编译运行后的结果。root@xuanfei-desktop:~/cpropram/2# cat global.h //头文件#ifndef CLOBAL_H #define GLOBAL_H #include int funca(void); int funcb(void);#endifroot@xuanfei-desktop:~/cpropram/2# cat funca.c //函数a#include "global.h"int funca(v 阅读全文
posted @ 2013-07-18 17:12 小葫芦藤 阅读(323) 评论(0) 推荐(0)

导航