]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Fix the REQUIRE_SYMBOL mechanism
authorMichael Brown <mcb30@ipxe.org>
Wed, 4 Mar 2015 18:48:19 +0000 (18:48 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 5 Mar 2015 00:59:38 +0000 (00:59 +0000)
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>
37 files changed:
src/arch/i386/include/bits/compiler.h
src/arch/i386/interface/pxe/pxe_call.c
src/arch/i386/prefix/kkkpxeprefix.S
src/arch/i386/prefix/romprefix.S
src/arch/i386/transitions/librm_test.c
src/arch/x86/drivers/hyperv/hyperv.c
src/arch/x86/drivers/xen/hvm.c
src/arch/x86_64/include/bits/compiler.h
src/config/config.c
src/config/config_ethernet.c
src/config/config_fc.c
src/config/config_infiniband.c
src/config/config_net80211.c
src/config/config_romprefix.c
src/config/config_route.c
src/config/config_usb.c
src/crypto/x509.c
src/drivers/bus/usb.c
src/drivers/net/rtl818x/rtl8180.c
src/drivers/net/rtl818x/rtl8185.c
src/drivers/net/vxge/vxge.c
src/hci/commands/image_trust_cmd.c
src/include/compiler.h
src/include/nic.h
src/net/80211/net80211.c
src/net/80211/wpa.c
src/net/ethernet.c
src/net/fc.c
src/net/infiniband.c
src/net/ipv4.c
src/net/ipv6.c
src/tests/cms_test.c
src/tests/ocsp_test.c
src/tests/tests.c
src/tests/x509_test.c
src/usr/route.c
src/util/elf2efi.c

index db512dbd34dbf4cb4789b4c184b5ba98544ad771..87201135f78cfe10a21ec91aa73c05df7a7e87b5 100644 (file)
@@ -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 */
index 9703733c14948ddf90105af5f35d348e97bd40bc..104313666e4272da5f2cb9b8654faa08db0018a6 100644 (file)
@@ -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 );
index 999fe1bf5b63d85595a4adf123bb18a32476ac26..6e43cd26acb0b12f0a275b49a37d8f814f679441 100644 (file)
@@ -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
index 08fcf73b19cf17626a8c3491a54527dffd0b844c..777b9e042acddc774b1821d65522c7960a98f10f 100644 (file)
@@ -875,5 +875,8 @@ wait_for_tick:
        ret
        .size wait_for_tick, . - wait_for_tick
 
+/* Drag in objects via _rom_start */
+REQUIRING_SYMBOL ( _rom_start )
+
 /* Drag in ROM configuration */
 REQUIRE_OBJECT ( config_romprefix )
index af7f0470d816219840b3a7f14b5e222c16cd2205..f1a517eda990c34b1079ec9676c7fd6179b135cd 100644 (file)
@@ -118,4 +118,5 @@ struct self_test librm_test __self_test = {
        .exec = librm_test_exec,
 };
 
+REQUIRING_SYMBOL ( librm_test );
 REQUIRE_OBJECT ( test );
index c3c0e86c091e497c6c5a2c96b6b1cfcf51d65107..f73829bd598b14aeefc44ccec5f806fbb44eeb8f 100644 (file)
@@ -590,5 +590,8 @@ struct root_device hv_root_device __root_device = {
        .driver = &hv_root_driver,
 };
 
+/* Drag in objects via hv_root_device */
+REQUIRING_SYMBOL ( hv_root_device );
+
 /* Drag in netvsc driver */
 REQUIRE_OBJECT ( netvsc );
index 6f3be8e2ec85e8dc3e64d86fedae007deee2f658..7ac32d54c3307bedff7980e04c687eecf6764eb1 100644 (file)
@@ -496,5 +496,8 @@ struct pci_driver hvm_driver __pci_driver = {
        .remove = hvm_remove,
 };
 
+/* Drag in objects via hvm_driver */
+REQUIRING_SYMBOL ( hvm_driver );
+
 /* Drag in netfront driver */
 REQUIRE_OBJECT ( netfront );
index 51a7eaae2adfb7ad7fe73b46844be5e47a80e1b7..f70b2e517b2acbdb1acecfae40d2cab861f3dda6 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _BITS_COMPILER_H
 #define _BITS_COMPILER_H
 
+/** Dummy relocation type */
+#define RELOC_TYPE_NONE R_X86_64_NONE
+
 #ifndef ASSEMBLY
 
 /** Declare a function with standard calling conventions */
index e4d378f0057ad5fe38e6e5059959af823fa745a0..470083888e7fc54a2dfdf468da3a65f86a477843 100644 (file)
@@ -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
  *
index e92399551de11131ea6333ba53d3af49123b2e7c..372ec99378229473adf4a9b795132371e960cec7 100644 (file)
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Drag in Ethernet-specific protocols
  */
index 2b317935466aa82b6906411ab452ba0d52c132e9..33fc9462a894664f8c9052cd56a7f908921ee402 100644 (file)
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Drag in Fibre Channel-specific commands
  *
index 13ed25a8faf3aa630ce9823a7d579c72bfc479dd..a742e7559a41f06bbc3f16cd923eb58b2ad8cd12 100644 (file)
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Drag in Infiniband-specific protocols
  */
index c89988a2c63bf9f1facbf7b835801dac3a0b33a8..3436175483a6f3d1f17adbc9756ad557c619cc56 100644 (file)
@@ -25,6 +25,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Drag in 802.11-specific commands
  *
index ad6f31f8510044eb84266d19d39bb6ef16f6c1e5..21921b867d639fb019b65d45bea6ceba3510aa08 100644 (file)
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Provide UNDI loader if PXE stack is requested
  *
index 38812ebb439fb9154d195f5f6d120fc5d39d9f07..c0b4ee91ddde3660e7a2ca11b6642354444b261f 100644 (file)
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Drag in routing management for relevant protocols
  *
index 5573023557b054eee8cf0f653827460618a45cda..30aa06c16158f3ea33351cef32f7543836d7636a 100644 (file)
@@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /*
  * Drag in USB controllers
  */
index 0f114b843bff77c74df7efac90907e97ed2a2c6e..49a1bce771faf6b47410cda3f82ee51ec36aaf1f 100644 (file)
@@ -1765,5 +1765,8 @@ int x509_validate_chain ( struct x509_chain *chain, time_t time,
        return -EACCES_USELESS;
 }
 
+/* Drag in objects via x509_validate() */
+REQUIRING_SYMBOL ( x509_validate );
+
 /* Drag in certificate store */
 REQUIRE_OBJECT ( certstore );
index 91d52b0cc3b0c42eff5507aab4b499eba168021f..22a57e6e5b773667598baa776fe7e2be1ddccac6 100644 (file)
@@ -1903,6 +1903,9 @@ struct usb_port * usb_root_hub_port ( struct usb_device *usb ) {
        return usb->port;
 }
 
+/* Drag in objects via register_usb_bus() */
+REQUIRING_SYMBOL ( register_usb_bus );
+
 /* Drag in USB configuration */
 REQUIRE_OBJECT ( config_usb );
 
index 8851d1bfbb0e188f124eb454ee396685b168357a..0c7d0775f6894ff1ca20871dfa22a62dfae35f34 100644 (file)
@@ -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);
index fd27e5c8c9817d4d7f1ebf498b1673ac10020e8a..438c5f24bc097c16c1b82899a149b0696f3d86b5 100644 (file)
@@ -4,6 +4,7 @@ FILE_LICENCE(GPL2_OR_LATER);
 
 #include <ipxe/pci.h>
 
+PROVIDE_REQUIRING_SYMBOL();
 REQUIRE_OBJECT(rtl818x);
 REQUIRE_OBJECT(rtl8185_rtl8225);
 
index bf20ec43c834133cf56f828c94793d38c896cfef..9c587722bc5545511196aa413942b464fac0e757 100644 (file)
@@ -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 */
index 094b5afaeeeabb4854be1f0894675c86668707c5..f9d6b5b3ed4b8d5680160614a59a92184e80d63b 100644 (file)
@@ -173,6 +173,9 @@ struct command image_trust_commands[] __command = {
        },
 };
 
+/* Drag in objects via command list */
+REQUIRING_SYMBOL ( image_trust_commands );
+
 /* Drag in objects typically required for signature verification */
 REQUIRE_OBJECT ( rsa );
 REQUIRE_OBJECT ( md5 );
index f877ebcec95eee05e0e7bbb5c239a34f202a2db6..ca82f9523c7ddaa2e07b698100d9b26d7986674c 100644 (file)
  * @{
  */
 
-/** Provide a symbol within this object file */
+/**
+ * Provide a symbol within this object file
+ *
+ * @v symbol           Symbol name
+ */
 #ifdef ASSEMBLY
-#define PROVIDE_SYMBOL( _sym )                         \
-       .section ".provided", "a", @nobits ;            \
-       .hidden _sym ;                                  \
-       .globl  _sym ;                                  \
-       _sym: ;                                         \
+#define PROVIDE_SYMBOL( symbol )                               \
+       .section ".provided", "a", @nobits ;                    \
+       .hidden symbol ;                                        \
+       .globl  symbol ;                                        \
+       symbol: ;                                               \
        .previous
-#else /* ASSEMBLY */
-#define PROVIDE_SYMBOL( _sym )                         \
-       char _sym[0]                                    \
+#else
+#define PROVIDE_SYMBOL( symbol )                               \
+       char symbol[0]                                          \
          __attribute__ (( section ( ".provided" ) ))
-#endif /* ASSEMBLY */
+#endif
 
-/** Require a symbol within this object file
+/**
+ * Request a symbol
+ *
+ * @v symbol           Symbol name
  *
- * The symbol is referenced by a relocation in a discarded section, so
- * if it is not available at link time the link will fail.
+ * Request a symbol to be included within the link.  If the symbol
+ * cannot be found, the link will succeed anyway.
  */
 #ifdef ASSEMBLY
-#define REQUIRE_SYMBOL( _sym )                         \
-       .section ".discard", "a", @progbits ;           \
-       .extern _sym ;                                  \
-       .long   _sym ;                                  \
-       .previous
-#else /* ASSEMBLY */
-#define REQUIRE_SYMBOL( _sym )                         \
-       extern char _sym;                               \
-       static char * _C2 ( _C2 ( __require_, _sym ), _C2 ( _, __LINE__ ) ) \
-               __attribute__ (( section ( ".discard" ), used )) \
-               = &_sym
+#define REQUEST_SYMBOL( symbol )                               \
+       .equ __request_ ## symbol, symbol
+#else
+#define REQUEST_SYMBOL( symbol )                               \
+       __asm__ ( ".equ __request_" #symbol ", " #symbol )
 #endif
 
-/** Request that a symbol be available at runtime
+/**
+ * Require a symbol
  *
- * The requested symbol is entered as undefined into the symbol table
- * for this object, so the linker will pull in other object files as
- * necessary to satisfy the reference. However, the undefined symbol
- * is not referenced in any relocations, so the link can still succeed
- * if no file contains it.
+ * @v symbol           Symbol name
+ *
+ * Require a symbol to be included within the link.  If the symbol
+ * cannot be found, the link will fail.
+ *
+ * To use this macro within a file, you must also specify the file's
+ * "requiring symbol" using the REQUIRING_SYMBOL() or
+ * PROVIDE_REQUIRING_SYMBOL() macros.
  */
 #ifdef ASSEMBLY
-#define REQUEST_SYMBOL( _sym )                         \
-       .equ    __need_ ## _sym, _sym
-#else /* ASSEMBLY */
-#define REQUEST_SYMBOL( _sym )                         \
-       __asm__ ( ".equ\t__need_" #_sym ", " #_sym )
-#endif /* ASSEMBLY */
+#define REQUIRE_SYMBOL( symbol )                               \
+       .reloc __requiring_symbol__, RELOC_TYPE_NONE, symbol
+#else
+#define REQUIRE_SYMBOL( symbol )                               \
+       __asm__ ( ".reloc __requiring_symbol__, "               \
+                 _S2 ( RELOC_TYPE_NONE ) ", " #symbol )
+#endif
+
+/**
+ * Specify the file's requiring symbol
+ *
+ * @v symbol           Symbol name
+ *
+ * REQUIRE_SYMBOL() works by defining a dummy relocation record
+ * against a nominated "requiring symbol".  The presence of the
+ * nominated requiring symbol will drag in all of the symbols
+ * specified using REQUIRE_SYMBOL().
+ */
+#ifdef ASSEMBLY
+#define REQUIRING_SYMBOL( symbol )                             \
+       .equ __requiring_symbol__, symbol
+#else
+#define REQUIRING_SYMBOL( symbol )                             \
+       __asm__ ( ".equ __requiring_symbol__, " #symbol )
+#endif
+
+/**
+ * Provide a file's requiring symbol
+ *
+ * If the file contains no symbols that can be used as the requiring
+ * symbol, you can provide a dummy one-byte-long symbol using
+ * PROVIDE_REQUIRING_SYMBOL().
+ */
+#ifdef ASSEMBLY
+#define PROVIDE_REQUIRING_SYMBOL()                             \
+       .section ".tbl.requiring_symbols", "a", @progbits ;     \
+       __requiring_symbol__:   .byte 0 ;                       \
+       .size __requiring_symbol__, . - __requiring_symbol__ ;  \
+       .previous
+#else
+#define PROVIDE_REQUIRING_SYMBOL()                             \
+       __asm__ ( ".section \".tbl.requiring_symbols\", "       \
+                 "         \"a\", @progbits\n"                 \
+                 "__requiring_symbol__:\t.byte 0\n"            \
+                 ".size __requiring_symbol__, "                \
+                 "      . - __requiring_symbol__\n"            \
+                 ".previous" )
+#endif
 
 /** @} */
 
 /** Always provide the symbol for the current object (defined by -DOBJECT) */
 PROVIDE_SYMBOL ( OBJECT_SYMBOL );
 
-/** Explicitly require another object */
-#define REQUIRE_OBJECT( _obj ) REQUIRE_SYMBOL ( obj_ ## _obj )
+/**
+ * Request an object
+ *
+ * @v object           Object name
+ *
+ * Request an object to be included within the link.  If the object
+ * cannot be found, the link will succeed anyway.
+ */
+#define REQUEST_OBJECT( object ) REQUEST_SYMBOL ( obj_ ## object )
 
-/** Pull in another object if it exists */
-#define REQUEST_OBJECT( _obj ) REQUEST_SYMBOL ( obj_ ## _obj )
+/**
+ * Require an object
+ *
+ * @v object           Object name
+ *
+ * Require an object to be included within the link.  If the object
+ * cannot be found, the link will fail.
+ *
+ * To use this macro within a file, you must also specify the file's
+ * "requiring symbol" using the REQUIRING_SYMBOL() or
+ * PROVIDE_REQUIRING_SYMBOL() macros.
+ */
+#define REQUIRE_OBJECT( object ) REQUIRE_SYMBOL ( obj_ ## object )
 
 /** @} */
 
@@ -685,8 +750,8 @@ int __debug_disable;
 
 /** @} */
 
-/* This file itself is under GPLv2-or-later */
-FILE_LICENCE ( GPL2_OR_LATER );
+/* This file itself is under GPLv2+/UBDL */
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
 #include <bits/compiler.h>
 
index d242333e5d05b4d4389414d596a35b71eddfbe1e..4c91f57a6f2ea65b30b4da197f32c8e33de6d713 100644 (file)
@@ -276,6 +276,7 @@ static inline void * legacy_isa_get_drvdata ( void *hwdev ) {
        _name ## _isa_legacy_remove ( struct isa_device *isa ) {          \
                return legacy_remove ( isa, legacy_isa_get_drvdata,       \
                                       _name ## _disable );               \
-       }
+       }                                                                 \
+       PROVIDE_REQUIRING_SYMBOL()
 
 #endif /* NIC_H */
index d2051f6429126c9e30f43aebca22a856aae0abf7..00794592eaa981c3f7795ea2b4547fb583a8dcad 100644 (file)
@@ -2827,5 +2827,8 @@ struct errortab common_wireless_errors[] __errortab = {
        __einfo_errortab ( EINFO_ECONNREFUSED_AUTH_ALGO_UNSUPP ),
 };
 
+/* Drag in objects via net80211_ll_protocol */
+REQUIRING_SYMBOL ( net80211_ll_protocol );
+
 /* Drag in 802.11 configuration */
 REQUIRE_OBJECT ( config_net80211 );
index e2c4945f9c674832b2e81c6cbb667f9b11f0cb0d..77f66d825b07b769aa119f5a0765128731ec7989 100644 (file)
@@ -912,4 +912,5 @@ struct eapol_handler eapol_key_handler __eapol_handler = {
 };
 
 /* WPA always needs EAPOL in order to be useful */
+REQUIRING_SYMBOL ( eapol_key_handler );
 REQUIRE_OBJECT ( eapol );
index a4bdfd4eed728aab94183155c3dafe9e1c59ae78..33e057250d86f66b708d54ed00a934e2622e033e 100644 (file)
@@ -239,6 +239,9 @@ struct net_device * alloc_etherdev ( size_t priv_size ) {
        return netdev;
 }
 
+/* Drag in objects via ethernet_protocol */
+REQUIRING_SYMBOL ( ethernet_protocol );
+
 /* Drag in Ethernet configuration */
 REQUIRE_OBJECT ( config_ethernet );
 
index 459f6fc36bed9b53175805e69b2719224f0a2590..2e8070272431575fc1a297efaafd0effc6cac729 100644 (file)
@@ -1940,5 +1940,8 @@ struct fc_ulp * fc_ulp_get_port_id_type ( struct fc_port *port,
        return NULL;
 }
 
+/* Drag in objects via fc_ports */
+REQUIRING_SYMBOL ( fc_ports );
+
 /* Drag in Fibre Channel configuration */
 REQUIRE_OBJECT ( config_fc );
index 7e545f74b7811a6c4c0a1987716d771cffe67406..8ba031f1df0d3c77a233d8166e2b4217f443c3da 100644 (file)
@@ -999,6 +999,9 @@ struct ib_device * last_opened_ibdev ( void ) {
        return ibdev;
 }
 
+/* Drag in objects via register_ibdev() */
+REQUIRING_SYMBOL ( register_ibdev );
+
 /* Drag in Infiniband configuration */
 REQUIRE_OBJECT ( config_infiniband );
 
index 85ee5a68bd0d20cc0829dca3309c641924bc96f1..ed22c4d317c8409a9c886206722e93ac15ec4c8e 100644 (file)
@@ -841,5 +841,8 @@ struct settings_applicator ipv4_settings_applicator __settings_applicator = {
        .apply = ipv4_create_routes,
 };
 
+/* Drag in objects via ipv4_protocol */
+REQUIRING_SYMBOL ( ipv4_protocol );
+
 /* Drag in ICMPv4 */
 REQUIRE_OBJECT ( icmpv4 );
index 3c374168cea6446bbd78c38539129e9fc29bed0a..c5bead1c63d9d50e330683256cfdbbdc49579d91 100644 (file)
@@ -1104,6 +1104,9 @@ struct net_driver ipv6_driver __net_driver = {
        .remove = ipv6_remove,
 };
 
+/* Drag in objects via ipv6_protocol */
+REQUIRING_SYMBOL ( ipv6_protocol );
+
 /* Drag in ICMPv6 */
 REQUIRE_OBJECT ( icmpv6 );
 
index 8962e2abe411b5ba4dd1804af43f097736e53709..b805a9974f80e8e0bd522eac399b53da428cbf7a 100644 (file)
@@ -1474,6 +1474,7 @@ struct self_test cms_test __self_test = {
 };
 
 /* Drag in algorithms required for tests */
+REQUIRING_SYMBOL ( cms_test );
 REQUIRE_OBJECT ( rsa );
 REQUIRE_OBJECT ( md5 );
 REQUIRE_OBJECT ( sha1 );
index a2f1f3390b38cd301b29ea842acf8c73a4c0b95c..c6d45859609ef32ee6345c21df58321b76e6fba0 100644 (file)
@@ -1861,5 +1861,6 @@ struct self_test ocsp_test __self_test = {
 };
 
 /* Drag in algorithms required for tests */
+REQUIRING_SYMBOL ( ocsp_test );
 REQUIRE_OBJECT ( rsa );
 REQUIRE_OBJECT ( sha1 );
index a79ddfa0794df74a922c4b7b3846961b9705fb6f..adb90f20146ef630a4a5cbbe398c311ebf622fcb 100644 (file)
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  */
 
 /* Drag in all applicable self-tests */
+PROVIDE_REQUIRING_SYMBOL();
 REQUIRE_OBJECT ( memset_test );
 REQUIRE_OBJECT ( memcpy_test );
 REQUIRE_OBJECT ( string_test );
index 67c8b39dbea8447c7b3a95db5251abd174fd4d7f..658d5247c1b8ab5f0b32838a38a43af82302fb26 100644 (file)
@@ -1109,6 +1109,7 @@ struct self_test x509_test __self_test = {
 };
 
 /* Drag in algorithms required for tests */
+REQUIRING_SYMBOL ( x509_test );
 REQUIRE_OBJECT ( rsa );
 REQUIRE_OBJECT ( sha1 );
 REQUIRE_OBJECT ( sha256 );
index eb50b5bb190198522a2ff53064a244c2995ad3ea..690ba3b6b7ec397a51e2578d3c041bdfc3e6dd14 100644 (file)
@@ -48,4 +48,5 @@ void route ( void ) {
 }
 
 /* Drag in routing management configuration */
+REQUIRING_SYMBOL ( route );
 REQUIRE_OBJECT ( config_route );
index 1e7a99b79c07cf694bf65d8de9fcc73f9e23093a..e68fa5d142b8ab42b137724c24e7ec71defda7a7 100644 (file)
@@ -478,6 +478,9 @@ static void process_reloc ( bfd *bfd __attribute__ (( unused )),
                /* Skip absolute symbols; the symbol value won't
                 * change when the object is loaded.
                 */
+       } else if ( ( strcmp ( howto->name, "R_386_NONE" ) == 0 ) ||
+                   ( strcmp ( howto->name, "R_X86_64_NONE" ) == 0 ) ) {
+               /* Ignore dummy relocations used by REQUIRE_SYMBOL() */
        } else if ( strcmp ( howto->name, "R_X86_64_64" ) == 0 ) {
                /* Generate an 8-byte PE relocation */
                generate_pe_reloc ( pe_reltab, offset, 8 );