mirror of
https://github.com/ipxe/ipxe
synced 2025-12-25 09:01:24 +03:00
[build] Use weak definitions instead of weak declarations
This removes the need for inline safety wrappers, marginally reducing the size penalty of weak functions, and works around an apparent binutils bug that causes undefined weak symbols to not actually be NULL when compiling with -fPIE (as EFI builds do). A bug in versions of binutils prior to 2.16 (released in 2005) will cause same-file weak definitions to not work with those toolchains. Update the README to reflect our new dependency on binutils >= 2.16. Signed-off-by: Joshua Oreman <oremanj@rwcr.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
committed by
Michael Brown
parent
ba27168c2e
commit
2aad3fab23
@@ -38,24 +38,6 @@ extern void pxe_activate ( struct net_device *netdev );
|
||||
extern int pxe_deactivate ( void );
|
||||
extern int pxe_start_nbp ( void );
|
||||
extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
|
||||
extern int _pxe_api_call_weak ( struct i386_all_regs *ix86 )
|
||||
__attribute__ (( weak ));
|
||||
|
||||
/**
|
||||
* Dispatch PXE API call weakly
|
||||
*
|
||||
* @v ix86 Registers for PXE call
|
||||
* @ret present Zero if the PXE stack is present, nonzero if not
|
||||
*
|
||||
* A successful return only indicates that the PXE stack was available
|
||||
* for dispatching the call; it says nothing about the success of
|
||||
* whatever the call asked for.
|
||||
*/
|
||||
static inline int pxe_api_call_weak ( struct i386_all_regs *ix86 )
|
||||
{
|
||||
if ( _pxe_api_call_weak != NULL )
|
||||
return _pxe_api_call_weak ( ix86 );
|
||||
return -1;
|
||||
}
|
||||
extern int pxe_api_call_weak ( struct i386_all_regs *ix86 );
|
||||
|
||||
#endif /* _PXE_CALL_H */
|
||||
|
||||
@@ -351,7 +351,7 @@ __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
||||
* @v ix86 Registers for PXE call
|
||||
* @ret present Zero (PXE stack present)
|
||||
*/
|
||||
int _pxe_api_call_weak ( struct i386_all_regs *ix86 )
|
||||
int pxe_api_call_weak ( struct i386_all_regs *ix86 )
|
||||
{
|
||||
pxe_api_call ( ix86 );
|
||||
return 0;
|
||||
|
||||
@@ -29,7 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
/**
|
||||
* Present cached DHCP packet if it exists
|
||||
*/
|
||||
void __weak_impl ( get_cached_dhcpack ) ( void ) {
|
||||
void get_cached_dhcpack ( void ) {
|
||||
struct undi_device *undi;
|
||||
struct s_PXENV_GET_CACHED_INFO get_cached_info;
|
||||
int rc;
|
||||
|
||||
@@ -318,6 +318,20 @@ static __asmcall void int21 ( struct i386_all_regs *ix86 ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dispatch PXE API call weakly
|
||||
*
|
||||
* @v ix86 Registers for PXE call
|
||||
* @ret present Zero if the PXE stack is present, nonzero if not
|
||||
*
|
||||
* A successful return only indicates that the PXE stack was available
|
||||
* for dispatching the call; it says nothing about the success of
|
||||
* whatever the call asked for.
|
||||
*/
|
||||
__weak int pxe_api_call_weak ( struct i386_all_regs *ix86 __unused ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* SYSLINUX API
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user