[U-Boot] using objdump/readelf/nm to dump symbols by individual source file?

Robert P. J. Day rpjday at crashcourse.ca
Sun Apr 7 16:28:57 UTC 2019


  i'm doing this in the context of building for ARM with a linaro
toolchain, but i'm sure it's equally valid in the context of a native
build.

  i'm trying to generate the same output as u-boot.map, but more
condensed and with each symbol associated with its original source
file (if that's even possible).

  for example, there are a couple weak symbols in board_f.c:

  __weak int arch_cpu_init(void)
  {
        return 0;
  }

  __weak int mach_cpu_init(void)
  {
        return 0;
  }

so depending on the target board, the final included version of such a
routine might come from board_f.c, or it might be overridden at the
board level.

  you can sort of see this in u-boot.map:

 .text.arch_cpu_init
                0x0000000000000000        0x8 common/built-in.o

 ...
 .text.mach_cpu_init
                0x0000000004011cac        0x8 common/built-in.o
                0x0000000004011cac                mach_cpu_init

except i was hoping to be able to list included symbols by their
*original* source file, and listed one file at a time, so the output
would have the format:

  board_f.o
    mach_cpu_init
    ... other stuff from board_f.o

i could swear i once knew how to do this, but i've forgotten (or
perhaps i'm misremembering). is there some variation of objdump,
readelf or nm that will do what i want? i need nothing other than, for
each source file, the symbols that were included in the final ELF file
from that source file.

  can i do this?

rday


More information about the U-Boot mailing list