Re: [PATCH] i386 and x86_64: randomize brk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux