@@ -358,7 +358,8 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
u16 *exit_data = NULL;
/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
- switch_to_non_secure_mode();
+ if (IS_ENABLED(CONFIG_WEAK_SYMBOLS))
+ switch_to_non_secure_mode();
/*
* The UEFI standard requires that the watchdog timer is set to five
@@ -13,6 +13,8 @@
#include <log.h>
#include <linux/compiler.h>
+#ifdef CONFIG_WEAK_SYMBOLS
+
int __weak bootz_setup(ulong image, ulong *start, ulong *end)
{
/* Please define bootz_setup() for your platform */
@@ -20,6 +22,7 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end)
puts("Your platform's zImage format isn't supported yet!\n");
return -1;
}
+#endif
/*
* zImage booting support
@@ -1220,6 +1220,8 @@ int usb_new_device(struct usb_device *dev)
}
#endif
+#ifdef CONFIG_WEAK_SYMBOLS
+
__weak
int board_usb_init(int index, enum usb_init_type init)
{
@@ -1231,6 +1233,7 @@ int board_usb_cleanup(int index, enum usb_init_type init)
{
return 0;
}
+#endif /* CONFIG_WEAK_SYMBOLS */
bool usb_device_has_child_on_port(struct usb_device *parent, int port)
{
@@ -347,10 +347,13 @@ int dm_extended_scan(bool pre_reloc_only)
}
#endif
+#ifdef CONFIG_WEAK_SYMBOLS
+
__weak int dm_scan_other(bool pre_reloc_only)
{
return 0;
}
+#endif
#if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY)
void *dm_priv_to_rw(void *priv)
@@ -41,12 +41,15 @@ struct sandbox_spi_priv {
uint mode;
};
+#ifdef CONFIG_WEAK_SYMBOLS
+
__weak int sandbox_spi_get_emul(struct sandbox_state *state,
struct udevice *bus, struct udevice *slave,
struct udevice **emulp)
{
return -ENOENT;
}
+#endif
uint sandbox_spi_get_speed(struct udevice *dev)
{
@@ -53,6 +53,8 @@ static struct env_driver *_env_driver_lookup(enum env_location loc)
return NULL;
}
+#ifdef CONFIG_WEAK_SYMBOLS
+
static enum env_location env_locations[] = {
#ifdef CONFIG_ENV_IS_IN_EEPROM
ENVL_EEPROM,
@@ -88,6 +90,7 @@ static enum env_location env_locations[] = {
ENVL_NOWHERE,
#endif
};
+#endif /* CONFIG_WEAK_SYMBOLS */
static bool env_has_inited(enum env_location location)
{
@@ -106,6 +109,8 @@ static void env_set_inited(enum env_location location)
gd->env_has_init |= BIT(location);
}
+#ifdef CONFIG_WEAK_SYMBOLS
+
/**
* arch_env_get_location() - Returns the best env location for an arch
* @op: operations performed on the environment
@@ -155,6 +160,7 @@ __weak enum env_location env_get_location(enum env_operation op, int prio)
{
return arch_env_get_location(op, prio);
}
+#endif /* CONFIG_WEAK_SYMBOLS */
/**
* env_driver_lookup() - Finds the most suited environment location
@@ -174,10 +174,13 @@ static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
return EFI_SUCCESS;
}
+#ifdef CONFIG_WEAK_SYMBOLS
+
void __weak invalidate_icache_all(void)
{
/* If the system doesn't support icache_all flush, cross our fingers */
}
+#endif
/**
* efi_set_code_and_data_type() - determine the memory types to be used for code
@@ -375,6 +375,9 @@ out:
return EFI_EXIT(EFI_UNSUPPORTED);
#endif
}
+
+#ifdef CONFIG_WEAK_SYMBOLS
+
/**
* efi_reset_system() - reset system
*
@@ -399,6 +402,7 @@ void __weak __efi_runtime EFIAPI efi_reset_system(
{
return;
}
+#endif /* CONFIG_WEAK_SYMBOLS */
/**
* efi_reset_system_init() - initialize the reset driver
@@ -148,9 +148,11 @@ void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
lmb_reserve(lmb, sp, bank_end - sp + 1);
+#ifdef CONFIG_WEAK_SYMBOLS
+
if (gd->flags & GD_FLG_SKIP_RELOC)
lmb_reserve(lmb, (phys_addr_t)(uintptr_t)_start, gd->mon_len);
-
+#endif
break;
}
}
@@ -179,6 +179,8 @@ uint64_t usec_to_tick(unsigned long usec)
return tick;
}
+#ifdef CONFIG_WEAK_SYMBOLS
+
void __weak __udelay(unsigned long usec)
{
uint64_t tmp;
@@ -188,6 +190,7 @@ void __weak __udelay(unsigned long usec)
while (get_ticks() < tmp+1) /* loop till event */
/*NOP*/;
}
+#endif
/* ------------------------------------------------------------------------- */
The sandbox build makes use of a small number of weak symbols. Allow these to be dropped when building for the PE format, since its support for weak symbols is poor. Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) cmd/bootefi.c | 3 ++- cmd/bootz.c | 3 +++ common/usb.c | 3 +++ drivers/core/root.c | 3 +++ drivers/spi/sandbox_spi.c | 3 +++ env/env.c | 6 ++++++ lib/efi_loader/efi_image_loader.c | 3 +++ lib/efi_loader/efi_runtime.c | 4 ++++ lib/lmb.c | 4 +++- lib/time.c | 3 +++ 10 files changed, 33 insertions(+), 2 deletions(-)