Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[build] Fix the REQUIRE_SYMBOL mechanism
At some point in the past few years, binutils became more aggressive at removing unused symbols. To function as a symbol requirement, a relocation record must now be in a section marked with @progbits and must not be in a section which gets discarded during the link (either via --gc-sections or via /DISCARD/). Update REQUIRE_SYMBOL() to generate relocation records meeting these criteria. To minimise the impact upon the final binary size, we use existing symbols (specified via the REQUIRING_SYMBOL() macro) as the relocation targets where possible. We use R_386_NONE or R_X86_64_NONE relocation types to prevent any actual unwanted relocation taking place. Where no suitable symbol exists for REQUIRING_SYMBOL() (such as in config.c), the macro PROVIDE_REQUIRING_SYMBOL() can be used to generate a one-byte-long symbol to act as the relocation target. If there are versions of binutils for which this approach fails, then the fallback will probably involve killing off REQUEST_SYMBOL(), redefining REQUIRE_SYMBOL() to use the current definition of REQUEST_SYMBOL(), and postprocessing the linked ELF file with something along the lines of "nm -u | wc -l" to check that there are no undefined symbols remaining. Signed-off-by: Michael Brown <mcb30@ipxe.org>
- Loading branch information
Showing
37 changed files
with
182 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -3,6 +3,9 @@ | ||
|
||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
|
||
/** Dummy relocation type */ | ||
#define RELOC_TYPE_NONE R_386_NONE | ||
|
||
#ifndef ASSEMBLY | ||
|
||
/** Declare a function with standard calling conventions */ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -346,6 +346,7 @@ int pxe_start_nbp ( void ) { | ||
return 0; | ||
} | ||
|
||
REQUIRING_SYMBOL ( pxe_api_call ); | ||
REQUIRE_OBJECT ( pxe_preboot ); | ||
REQUIRE_OBJECT ( pxe_undi ); | ||
REQUIRE_OBJECT ( pxe_udp ); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -8,6 +8,7 @@ | ||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ) | ||
|
||
/* Provide the PXENV_FILE_EXIT_HOOK API call */ | ||
REQUIRING_SYMBOL ( _kkkpxe_start ) | ||
REQUIRE_OBJECT ( pxe_exit_hook ) | ||
|
||
#define PXELOADER_KEEP_UNDI | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -118,4 +118,5 @@ struct self_test librm_test __self_test = { | ||
.exec = librm_test_exec, | ||
}; | ||
|
||
REQUIRING_SYMBOL ( librm_test ); | ||
REQUIRE_OBJECT ( test ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -44,6 +44,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* in the final iPXE executable built. | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in all requested console types | ||
* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in Ethernet-specific protocols | ||
*/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in Fibre Channel-specific commands | ||
* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in Infiniband-specific protocols | ||
*/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -25,6 +25,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in 802.11-specific commands | ||
* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Provide UNDI loader if PXE stack is requested | ||
* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in routing management for relevant protocols | ||
* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); | ||
* | ||
*/ | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
|
||
/* | ||
* Drag in USB controllers | ||
*/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -4,6 +4,7 @@ FILE_LICENCE(GPL2_OR_LATER); | ||
|
||
#include <ipxe/pci.h> | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
REQUIRE_OBJECT(rtl818x); | ||
REQUIRE_OBJECT(rtl8180_grf5101); | ||
REQUIRE_OBJECT(rtl8180_max2820); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -4,6 +4,7 @@ FILE_LICENCE(GPL2_OR_LATER); | ||
|
||
#include <ipxe/pci.h> | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
REQUIRE_OBJECT(rtl818x); | ||
REQUIRE_OBJECT(rtl8185_rtl8225); | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -9,6 +9,7 @@ FILE_LICENCE(GPL2_OR_LATER); | ||
|
||
#include <ipxe/pci.h> | ||
|
||
PROVIDE_REQUIRING_SYMBOL(); | ||
REQUIRE_OBJECT(vxge_main); | ||
|
||
/** vxge PCI IDs for util/parserom.pl which are put into bin/NIC */ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.