The problem is that, even though you have this in your header file:
extern unsigned long int my_count_s[40];
you still haven't defined the array anywhere - you've only declared that it exists somewhere.
In some source file (probably arch/x6/kvm/vmx.c
), you need to define the array:
unsigned long int my_count_s[40];
Remember, extern
says "Hey compiler, this variable exists in some module." That's why we put extern
declarations in header files. They don't actually cause any space to be allocated for the variable, they just indicate its existence.
The line without extern
is the definition, and is put in a .c
file. It is in that compilation unit that space is actually reserved for the variable.
On another note. Does this variable need to be globally-scoped? If arch/x6/kvm/vmx.c
is the only file that references it, then it should not be in the header file, and should be marked as static
in the .c
file:
static unsigned long int my_count_s[40];
Here, static
limits its visibility to only the C file that it is defined in.