Re: [PATCH] i386 and x86_64: randomize brk()
From: Jiri Kosina
Date: Mon Sep 03 2007 - 05:34:24 EST
On Sun, 2 Sep 2007, Andrew Morton wrote:
> > What about using a weak function in that case ? It actually gives a
> > default implementation in _one_ place and can be changed easily from a
> > nop to something more complex later.
> Yeah, weak functions are by far the cleanest way of doing this - they're
> most elegant. But they do add the overhead of an empty call/return, so
> some thought needs to go into the tradeoff.
Hi,
the problem I am seeing with __weak functions is that as far as I can see,
gcc 4.1.0 optimizes the empty __weak function away with -O2, so it is not
later properly overridden by the other non-weak function, as the callsite
already doesn't have the corresponding call. (when I stick a printk() into
the __weak function, everything works fine - it is not optimized away and
non-weak version of the function gets called).
I persume this is a bug in gcc (4.1.1 doesn't seem to expose this
behavior). I will look at it a little bit more.
Thanks,
--
Jiri Kosina
SUSE Labs
-
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/