Reputation: 181
I have 2 copies of Linux kernel code (same version: 3.0.1), one is vanilla source code and the other with some modifications. After compiling both of them with the same config file (the unmodified code prompts for some additional configurations about drivers during make), they output slightly different Module.symvers
file, which is reasonable. I then use awk
to only list the first 2 fields of them to better comparing the symbol checksums. Most of the symbol checksums are the same, but some of the symbols' checksums are different. According to this article from lwn.net:
the checksum is calculated from the prototype or declaration of the symbol.
those different ones should have different prototype or declaration. But I find that this is not true. I picked two of them (functions) and comparing the source code, one of them differ in the definition (i.e. function body) and the other function is exactly the same in two source code. (I used vimdiff
to compare and the spacing is identical). Both of the functions have the same prototype.
So things may have changed? What exactly is causing the checksums different nowadays (In my case after 3.0.1). I don't want to know the details of how the checksum are calculated, I just want to get a brief idea about what is making a difference here.
Upvotes: 2
Views: 774
Reputation: 65860
When checksum of exported function is calculated, every type in function's prototype (parameter's type or type of returning value) is evaluated not only literally, but also by definition. If a type is complex(e.g., structure), its fields are checked too. (That is, process is recursive).
Type's definition is checked even if the parameter is actually a pointer to a type.
E.g., functions declarations below will have different checksums:
Kernel1:
struct a
{
int i;
};
void f(struct a* arg);
Kernel2:
struct a
{
int i;
char c;
};
void f(struct a* arg);
Upvotes: 3