From b7e7f62b87dcab7f4feed3b77352d057723b134c Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 28 Jan 2026 12:25:26 +0000 Subject: [PATCH] [efi] Avoid dragging in IPv4, IPv6, and DNS support unconditionally The efi_path_settings[] array includes symbol references to &ip_setting, &ip6_setting, &dns_setting (and others) that currently result in IPv4, IPv6, and DNS support being linked in even if disabled in the build configuration. Provide weak versions of these symbols to avoid the unconditional inclusion of these features. Reported-by: Pavitter Ghotra Signed-off-by: Michael Brown --- src/interface/efi/efi_path.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/interface/efi/efi_path.c b/src/interface/efi/efi_path.c index 37558c36e..38f6f2184 100644 --- a/src/interface/efi/efi_path.c +++ b/src/interface/efi/efi_path.c @@ -994,6 +994,16 @@ static int efi_path_fetch_dns ( struct efi_path_setting *pathset, return ( count * pathset->len ); } +/* Avoid dragging in IPv4, IPv6, and DNS support if not otherwise used */ +extern const struct setting ip_setting __attribute__ (( weak )); +extern const struct setting netmask_setting __attribute__ (( weak )); +extern const struct setting gateway_setting __attribute__ (( weak )); +extern const struct setting ip6_setting __attribute__ (( weak )); +extern const struct setting len6_setting __attribute__ (( weak )); +extern const struct setting gateway6_setting __attribute__ (( weak )); +extern const struct setting dns_setting __attribute__ (( weak )); +extern const struct setting dns6_setting __attribute__ (( weak )); + /** EFI device path settings */ static struct efi_path_setting efi_path_settings[] = { { &ip_setting, efi_path_fetch_fixed, MESSAGING_DEVICE_PATH, @@ -1047,6 +1057,8 @@ static int efi_path_fetch ( struct settings *settings, struct setting *setting, /* Check for a matching setting */ pathset = &efi_path_settings[i]; + if ( ! pathset->setting ) + continue; if ( setting_cmp ( setting, pathset->setting ) != 0 ) continue;