Build: don't use HAVE_FUNCTION_SECTIONS for update-mocks.

I ran `uv run make update-mocks` and many mocks vanished.  But that
broke MacOS (and maybe other archs) which doesn't support function
sections and no longer linked.

If this proves problematic, we might end up generating mocks properly:
1. Use #include "mocks-sphinx-xor_cipher_stream_gen.c"
2. Generate those separate files as necessary.
3. Don't commit them, build them locally.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2026-02-17 12:44:03 +10:30
parent 1e608584a5
commit 15ef2fd39c
4 changed files with 1 additions and 13 deletions

View file

@ -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(); }

View file

@ -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(); }

View file

@ -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(); }

View file

@ -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