Skip to contentSkip to conversation

Question: "genksyms: Track changes to enum constants" doesn't work

DISCUSSION shengyong 2 participants 2 messages Mar 11, 2015 – Mar 12, 2015 Kbuild

lore
Share & tools
lore

shengyong

author
#0 lore raw

Hi, Michal Marek

The commit e37ddb8250 ("genksyms: Track changes to enum constants") helps to changes the checksum of export symbol if an enum is changed. I test this agains linux-next, but it seems that it does not work well.

	#include <linux/module.h>
	#include <linux/kernel.h>
	#include <linux/init.h>

	enum a {
		E1,
		E2,
		E_MAX
	};

	struct s {
		int a[E_MAX];
	};

	int test(struct s *s)
	{
		s->a[E2] = 0;
		return 0;
	}
	EXPORT_SYMBOL(test);
	
	static int __init hello_init(void) { return 0; }
	static void __exit hello_exit(void) { return; }
	module_init(hello_init);
	module_exit(hello_exit);

After compiled, I get:

$ cat Module.symvers
*0xb6ca7216*	test	/home/test/module/hello	EXPORT_SYMBOL

Then add an "E3" in the enum:

	enum a {
		E1,
		E2,
	+	E3,
		E_MAX
	};

After compiled, I still get:

$ cat Module.symvers
*0xb6ca7216*	test	/home/test/module/hello	EXPORT_SYMBOL

Anything wrong with my test?

thanks,
Sheng

#1 lore raw

Dne 11.3.2015 v 05:24 shengyong napsal(a):

Quoted 6 lines

Hi, Michal Marek

The commit e37ddb8250 ("genksyms: Track changes to enum constants") helps to changes the checksum of export symbol if an enum is changed. I test this agains linux-next, but it seems that it does not work well.

Quoted 13 lines
	#include <linux/module.h>
	#include <linux/kernel.h>
	#include <linux/init.h>

	enum a {
		E1,
		E2,
		E_MAX
	};

	struct s {
		int a[E_MAX];
	};

What you are seeing is the effect of commit 2c5925d ("genksyms: Do not expand internal types"). You need to move the type definitions to a header for these to be considered by genksyms.

Michal