lkml.org 
[lkml]   [2007]   [Sep]   [3]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 3 Sep 2007 11:34:06 +0200 (CEST)
FromJiri Kosina <>
SubjectRe: [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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-09-03 11:37    [from the cache]
©2003-2008