Messages in this thread | | | Date | Mon, 12 Jan 2009 11:33:49 -0600 (CST) | From | Christoph Lameter <> | Subject | Re: [patch 2/8] compiler-gcc.h: add more comments to RELOC_HIDE |
| |
On Sat, 10 Jan 2009, Ingo Molnar wrote:
> 2) Special structure sizes > > For example we want to load a value from "&var + LARGE_OFFSET" (common > percpu construct). If 'var' is a C structure that happens to have a size > of 255 bytes, then GCC could legitimately assume that 'LARGE_OFFSET' is > 0..255 [inclusive], and could optimize LARGE_OFFSET to be truncated to a > single byte.
But that is not what is occurring. We do not do &var + LARGE_OFFSET. Instead one does
((void *)&var) + LARGE_OFFSET
or ((unsigned long)&var) + LARGE_OFFSET
The cast should cause the C compiler to drop all assumptions about size. And the definition of RELOC_HIDE for icc and generic compilers in the tree show that this is working.
| |