I'm not sure.. We do:
#define RELOC(x) (*PTRRELOC(&(x)))
#define PTRRELOC(x) ((typeof(x))((unsigned long)(x) + offset))
unsigned long offset = reloc_offset();
...
strcpy(namep, RELOC("linux,phandle"));
Which is basically inlining, yes?
> Conversely, what if these were the real stdlib calls that they seem to
> be? Still the same bug. Absence or presence of the standard library
> is not essential to the problem, and so -ffreestanding can be a fragile
> workaround at best.
Yes, but doesn't -ffreestanding imply that gcc _can't_ assume this is
the standard library, and that strcpy _might_ not be what it thinks, and
to just call strpy?
> The bug just happens to get triggered by a 'builtin' optimization, because
> gcc 3.0.3 is a little more aggressive with those. We can't keep the
> progress of gcc's optimizer back just for a kernel. Asking for a new
> option or #pragma, okay. But weeding out otherwise valid assumptions that
> help many inputs but break one? Better to fix the one, even if it does
> cost you some speed there.
We aren't saying this is always a bad thing, but what if we want to turn
off a built-in optimization? Unless -ffreestanding stops implying
-fno-builtin (maybe we could just add -fno-builtin for this one file..),
this line should be fine.
> Oh, and another suggestion: would having RELOC cast the pointer to the
> intermediate type "const volatile void *" make gcc drop its assumptions
> on that one pointer, and avoid the optimization? It may not be exactly
> what the Standard had in mind when it defined "volatile," but then again
> the definition was deliberately left vague.
I _think_ this is option 3 or so that I mentioned in another email.
Modify RELOC so that gcc will drop its assumptions and just do what we
explicitly say.
-- Tom Rini (TR1265) http://gate.crashing.org/~trini/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/