diff options
| author | Joshua Oreman | 2010-08-19 01:37:22 +0200 |
|---|---|---|
| committer | Michael Brown | 2010-08-19 14:37:52 +0200 |
| commit | 49d6f5700561be091b2b25bb7641708333e4911d (patch) | |
| tree | ac34755391ad3025d3fd817af3696d1bca3276cf /src/net | |
| parent | [build] Add tap.linux to "make everything" (diff) | |
| download | ipxe-49d6f5700561be091b2b25bb7641708333e4911d.tar.gz ipxe-49d6f5700561be091b2b25bb7641708333e4911d.tar.xz ipxe-49d6f5700561be091b2b25bb7641708333e4911d.zip | |
[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>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/udp/dhcp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index fb62bef53..77d465453 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -1389,7 +1389,7 @@ static struct sockaddr dhcp_peer = { /** * Get cached DHCPACK where none exists */ -__weak void get_cached_dhcpack ( void ) {} +__weak void get_cached_dhcpack ( void ) { __keepme } /** * Start DHCP state machine on a network device |
