James Carlson wrote: > Nils Goroll writes: >> I am crossposting to networking-discuss and tools-compilers because I am not >> sure if this is a compiler issue or a bug in the rpc module: > > It's a bug in the "rpc" module. Tunables must never be declared > 'static' or the compiler can and will optimize them away (as you've > discovered). This is a fairly old but recurring issue -- see CRs > 4354490 and 6734437.
The ELF symbols are different for global vs static symbols. If you have a list of known tunables, you should be able to audit this automatically by having the build scan the symbols after you compile. --chris > > It's something that code reviewers should catch. > >> Any pointers are highly appreciated. If this is not a compiler bug, I'd open >> a >> bug and prepare a webrev with the fix. If this issue is fixed with current >> compilers, I apologize for the noise. > > Not a compiler bug, in my opinion. The compiler is doing exactly what > we told it to do ("assume nobody outside of this module can modify > this value unless someone here takes its address") ... just not what > we wanted. >