- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在制作一个简单的内核对象。但不知何故,变量没有用 EXPORT_SYMBIL 宏导出。来源是:
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("Dual BSD/GPL");
int hello_int __attribute__ ((__unused__));
EXPORT_SYMBOL(hello_int);
static int hello_init(void)
{
printk(KERN_ALERT "driver loaded\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "driver unloaded\n");
}
module_init(hello_init);
module_exit(hello_exit);
但是。
# insmod hello.ko
# cat /proc/kallsyms | grep hello
d9fb0000 t hello_exit [hello]
d9fb000c t hello_init [hello]
d9fb0000 t cleanup_module [hello]
d9fb000c t init_module [hello]
d9f6374e t br_hello_timer_expired [bridge]
d9f64027 t show_hello_timer [bridge]
d9f640fb t store_hello_time [bridge]
d9f64264 t set_hello_time [bridge]
d9f641ee t show_hello_time [bridge]
那里没有 hello_int。但可以肯定的是,
# cat Module.symvers
0x8ed8de1a hello_int /home/ken/myprojects/hello/hello EXPORT_SYMBOL
为什么?有什么问题吗?
# uname -a
Linux debian-6-0-6-i386 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686 GNU/Linux
这里是 Makefile:
obj-m := hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
最佳答案
你的问题是内核没有配置 CONFIG_KALLSYMS_ALL
设置,导致它只导出函数而不导出变量。我发现很难 track what happened in relation to this ,但看起来在某个时刻该标志已在其中一个内核更新中启用。
关于linux - 为什么我的符号没有用 EXPORT_SYMBOL 导出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12785512/
众所周知,在使用 EXPORT_SYMBOL("function name") 时,我们进入 System.map 中的符号列表,将函数名称作为符号。 c041bc90 b packet_sklist
假设我在文件 new.c 中定义了一个函数 hello_world()。我用这个文件 new.c 和另一个文件 hello.c 创建了一个模块。这个模块将被称为 new.ko。使用 EXPORT_SY
我是 linux 内核的新手。我搜索了一些 EXPORT_SYMBOL 但我还是有点困惑。我知道它用于将一个模块中定义的变量或函数导出到另一个模块。这是否意味着通过使用它,我们不需要包含任何声明该变量
我想在我的 netfilter 模块中使用 net/ip_options.c 文件中定义的函数,如 ip_options_compile、ip_options_build。 我想将选项放入 IP 数据
我正在制作一个简单的内核对象。但不知何故,变量没有用 EXPORT_SYMBIL 宏导出。来源是: #include #include MODULE_LICENSE("Dual BSD/GPL")
我有一个内核模块,其结构如下: struct test { int a; int b; ..... } 我已经创建了这个结构的一个实例数组: struct test foo[8
来自 here 48 struct snd_card *snd_cards[SNDRV_CARDS]; 49 EXPORT_SYMBOL(snd_cards); 我不明白它的含义以及使用它的原因。
我正在尝试编译并插入 r8169 realtek 以太网驱动程序。我的内核版本是 ebin@sony:~$ uname -r 4.2.0-rc3-custom 我的本地磁盘中有相同的完整源代码,用
我们需要访问 net/ipv4/af_inet.c 中的内核全局变量,这些变量未从可加载内核模块中显式导出。我们目前使用的是2.6.18内核。 kallsyms_lookup_name 似乎不再可用(
我正在 aarch64 机器上开发 4.9 Linux 内核,特别是 mm/memory.c 和自定义平台设备驱动程序。我的目标是让我的设备驱动程序将一些信息传递给源自 memory.c 中函数的硬件
我有一个来自 a.ko(内核模块)的导出函数 foo() 和 foo1(),foo1() 接受输入参数,一个函数指针。我从 b.ko 调用 foo1(),并将 foo() 作为输入参数传递。 我看到
我有一个头文件,其中声明了几个全局变量,格式如下: constants.h #ifndef CONSTANTS_H #define CONSTANTS_H extern unsigned var; E
当我遇到这个错误时,我正在将一些驱动程序嵌入到 Linux 内核中(我正在将设备添加到板文件中并注册它): error: 'kxtf9_get_slave_descr' undeclared here
我是一名优秀的程序员,十分优秀!