[PATCH RFC 1/3] drop unused kallsyms support

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Jul 22 08:41:55 CEST 2024


On Wed, 10 Jul 2024 at 19:26, Caleb Connolly <caleb.connolly at linaro.org> wrote:
>
> There was some very old code floating around for decoding symbols, it's
> incomplete and is never built. Remove it so we can add a new
> implementation.
>
> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> ---
>  Makefile            | 11 -----------
>  common/Makefile     |  1 -
>  common/kallsyms.c   | 43 -------------------------------------------
>  common/system_map.c |  8 --------
>  4 files changed, 63 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index f5b2512f3690..fcb9565d2fff 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1786,21 +1786,10 @@ quiet_cmd_u-boot__ ?= LD      $@
>                 $(PLATFORM_LIBS) -Map u-boot.map;                               \
>                 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
>  endif
>
> -quiet_cmd_smap = GEN     common/system_map.o
> -cmd_smap = \
> -       smap=`$(call SYSTEM_MAP,u-boot) | \
> -               awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
> -       $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
> -               -c $(srctree)/common/system_map.c -o common/system_map.o
> -
>  u-boot:        $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) u-boot.lds FORCE
>         +$(call if_changed,u-boot__)
> -ifeq ($(CONFIG_KALLSYMS),y)
> -       $(call cmd,smap)
> -       $(call cmd,u-boot__) common/system_map.o
> -endif
>
>  ifeq ($(CONFIG_RISCV),y)
>         @tools/prelink-riscv $@
>  endif
> diff --git a/common/Makefile b/common/Makefile
> index e98354734206..bca02e4c362f 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -34,9 +34,8 @@ obj-$(CONFIG_USB_ONBOARD_HUB) += usb_onboard_hub.o
>  obj-$(CONFIG_CONSOLE_MUX) += iomux.o
>  obj-$(CONFIG_MTD_NOR_FLASH) += flash.o
>  obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
>  obj-$(CONFIG_I2C_EDID) += edid.o
> -obj-$(CONFIG_KALLSYMS) += kallsyms.o
>  obj-y += splash.o
>  obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
>  obj-$(CONFIG_MENU) += menu.o
>  obj-$(CONFIG_UPDATE_COMMON) += update.o
> diff --git a/common/kallsyms.c b/common/kallsyms.c
> deleted file mode 100644
> index 49b3897078ae..000000000000
> --- a/common/kallsyms.c
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/*
> - * Helper functions for working with the builtin symbol table
> - *
> - * Copyright (c) 2008-2009 Analog Devices Inc.
> - * Licensed under the GPL-2 or later.
> - */
> -
> -
> -/* We need the weak marking as this symbol is provided specially */
> -extern const char system_map[] __attribute__((weak));
> -
> -/* Given an address, return a pointer to the symbol name and store
> - * the base address in caddr.  So if the symbol map had an entry:
> - *             03fb9b7c_spi_cs_deactivate
> - * Then the following call:
> - *             unsigned long base;
> - *             const char *sym = symbol_lookup(0x03fb9b80, &base);
> - * Would end up setting the variables like so:
> - *             base = 0x03fb9b7c;
> - *             sym = "_spi_cs_deactivate";
> - */
> -const char *symbol_lookup(unsigned long addr, unsigned long *caddr)
> -{
> -       const char *sym, *csym;
> -       char *esym;
> -       unsigned long sym_addr;
> -
> -       sym = system_map;
> -       csym = NULL;
> -       *caddr = 0;
> -
> -       while (*sym) {
> -               sym_addr = hextoul(sym, &esym);
> -               sym = esym;
> -               if (sym_addr > addr)
> -                       break;
> -               *caddr = sym_addr;
> -               csym = sym;
> -               sym += strlen(sym) + 1;
> -       }
> -
> -       return csym;
> -}
> diff --git a/common/system_map.c b/common/system_map.c
> deleted file mode 100644
> index 8307293bf3ae..000000000000
> --- a/common/system_map.c
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -/*
> - * The builtin symbol table for use with kallsyms
> - *
> - * Copyright (c) 2008-2009 Analog Devices Inc.
> - * Licensed under the GPL-2 or later.
> - */
> -
> -const char const system_map[] = SYSTEM_MAP;
>
> --
> 2.45.2
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>


More information about the U-Boot mailing list