2 * Helper functions for working with the builtin symbol table
4 * Copyright (c) 2008-2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
8 /* We need the weak marking as this symbol is provided specially */
9 extern const char system_map[] __attribute__((weak));
11 /* Given an address, return a pointer to the symbol name and store
12 * the base address in caddr. So if the symbol map had an entry:
13 * 03fb9b7c_spi_cs_deactivate
14 * Then the following call:
16 * const char *sym = symbol_lookup(0x03fb9b80, &base);
17 * Would end up setting the variables like so:
19 * sym = "_spi_cs_deactivate";
21 const char *symbol_lookup(unsigned long addr, unsigned long *caddr)
23 const char *sym, *csym;
25 unsigned long sym_addr;
32 sym_addr = hextoul(sym, &esym);
38 sym += strlen(sym) + 1;