Re: [patch 2/8] compiler-gcc.h: add more comments to RELOC_HIDE

From: Christoph Lameter
Date: Mon Jan 12 2009 - 12:34:47 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/