[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0709031130000.16753@jikos.suse.cz>
Date: Mon, 3 Sep 2007 11:34:06 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Franck Bui-Huu <vagabon.xyz@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i386 and x86_64: randomize brk()
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists