[compiler] Prevent empty weak function stubs from being removed master
authorJoshua Oreman <oremanj@rwcr.net>
Wed, 18 Aug 2010 23:37:22 +0000 (16:37 -0700)
committerJoshua Oreman <oremanj@rwcr.net>
Thu, 19 Aug 2010 00:39:09 +0000 (17:39 -0700)
commit53bb50e276bce07d14f39aedd5602c131bc96a02
treef23f804dafbdfec10f79c0f529e2d776e8774715
parentfa91c2c3269554df855107a24afec9a1149fee8f
[compiler] Prevent empty weak function stubs from being removed

Even with the noinline specifier added by commit 1a260f8, gcc may
skip calls to non-inlinable functions that it knows have no side
effects. This caused the get_cached_dhcpack() call in start_dhcp(),
the weak stub of which has no code in its body, to be removed,
preventing cached DHCP from working.

Fix by adding a __keepme macro to compiler.h expanding to asm(""),
as recommended by gcc's info page, and using it in the weak stub
for get_cached_dhcpack().

Reported-by: Aaron Brooks <aaron@brooks1.net>
Tested-by: Aaron Brooks <aaron@brooks1.net>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
src/include/compiler.h
src/net/udp/dhcp.c