Build: don't use HAVE_FUNCTION_SECTIONS for update-mocks.
What changed, and why it matters
This is a build-system fix for a developer-only mock-generation script. It stops using a compiler feature (function sections) that is unsupported on macOS, which had caused test builds to fail after mocks were regenerated. There is no runtime security issue or user impact.
No security action needed; treat as normal build-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tools/update-mocks.sh to pass HAVE_FUNCTION_SECTIONS=0 when building unit-test binaries during mock regeneration. It also removes a few now-unneeded generated mock stubs from three test files. The change is purely about restoring the ability to run make update-mocks on platforms without function-section support; it does not alter production code, network behavior, or cryptographic logic.
Changed components
tools/update-mocks.shcommon/test/run-sphinx-xor_cipher_stream.cconnectd/test/run-crc32_of_update.cgossipd/test/run-next_block_range.cInspect captured patch +1 / −13
diff --git a/common/test/run-sphinx-xor_cipher_stream.c b/common/test/run-sphinx-xor_cipher_stream.c
index b5a30ef7..0e33ace5 100644
--- a/common/test/run-sphinx-xor_cipher_stream.c
+++ b/common/test/run-sphinx-xor_cipher_stream.c
@@ -108,9 +108,6 @@ void subkey_from_hmac(const char *prefix UNNEEDED,
const struct secret *base UNNEEDED,
struct secret *key UNNEEDED)
{ fprintf(stderr, "subkey_from_hmac called!\n"); abort(); }
-/* Generated stub for tlv_payload_new */
-struct tlv_payload *tlv_payload_new(const tal_t *ctx UNNEEDED)
-{ fprintf(stderr, "tlv_payload_new called!\n"); abort(); }
/* Generated stub for towire */
void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED)
{ fprintf(stderr, "towire called!\n"); abort(); }
@@ -136,9 +133,6 @@ void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED,
/* Generated stub for towire_sha256 */
void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED)
{ fprintf(stderr, "towire_sha256 called!\n"); abort(); }
-/* Generated stub for towire_tlv_payload */
-void towire_tlv_payload(u8 **pptr UNNEEDED, const struct tlv_payload *record UNNEEDED)
-{ fprintf(stderr, "towire_tlv_payload called!\n"); abort(); }
/* Generated stub for towire_u16 */
void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED)
{ fprintf(stderr, "towire_u16 called!\n"); abort(); }
diff --git a/connectd/test/run-crc32_of_update.c b/connectd/test/run-crc32_of_update.c
index 62c3c5fe..0f48c706 100644
--- a/connectd/test/run-crc32_of_update.c
+++ b/connectd/test/run-crc32_of_update.c
@@ -17,9 +17,6 @@ int unused_main(int argc, char *argv[]);
/* Generated stub for fromwire_connectd_dev_set_max_scids_encode_size */
bool fromwire_connectd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
{ fprintf(stderr, "fromwire_connectd_dev_set_max_scids_encode_size called!\n"); abort(); }
-/* Generated stub for fromwire_gossip_store_chan_dying */
-bool fromwire_gossip_store_chan_dying(const void *p UNNEEDED, struct short_channel_id *scid UNNEEDED, u32 *blockheight UNNEEDED)
-{ fprintf(stderr, "fromwire_gossip_store_chan_dying called!\n"); abort(); }
/* Generated stub for get_gossmap */
struct gossmap *get_gossmap(struct daemon *daemon UNNEEDED)
{ fprintf(stderr, "get_gossmap called!\n"); abort(); }
diff --git a/gossipd/test/run-next_block_range.c b/gossipd/test/run-next_block_range.c
index f4dae400..fc888ed9 100644
--- a/gossipd/test/run-next_block_range.c
+++ b/gossipd/test/run-next_block_range.c
@@ -20,9 +20,6 @@ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id
struct peer *first_random_peer(struct daemon *daemon UNNEEDED,
struct peer_node_id_map_iter *it UNNEEDED)
{ fprintf(stderr, "first_random_peer called!\n"); abort(); }
-/* Generated stub for fromwire_gossip_store_chan_dying */
-bool fromwire_gossip_store_chan_dying(const void *p UNNEEDED, struct short_channel_id *scid UNNEEDED, u32 *blockheight UNNEEDED)
-{ fprintf(stderr, "fromwire_gossip_store_chan_dying called!\n"); abort(); }
/* Generated stub for gossmap_manage_get_gossmap */
struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm UNNEEDED)
{ fprintf(stderr, "gossmap_manage_get_gossmap called!\n"); abort(); }
diff --git a/tools/update-mocks.sh b/tools/update-mocks.sh
index 1239c604..40428cb0 100755
--- a/tools/update-mocks.sh
+++ b/tools/update-mocks.sh
@@ -14,7 +14,7 @@ END=$(grep -F -n '/* AUTOGENERATED MOCKS END */' "$FILE" | cut -d: -f1)
function make_binary() {
# Make sure we don't optimize out options, and we use debug build
- $MAKE SUPPRESS_GENERATION=1 "${FILE/%.c/}" DEBUGBUILD=1 COPTFLAGS="" 2> "${BASE}.err" >/dev/null
+ $MAKE SUPPRESS_GENERATION=1 "${FILE/%.c/}" DEBUGBUILD=1 COPTFLAGS="" HAVE_FUNCTION_SECTIONS=0 2> "${BASE}.err" >/dev/null
}
if [ -n "$START" ]; then
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.