• Using nm or objdump to get symbol and its size in android


    1. cd out/soong/.intermediates/hardware/interfaces/sensors/1.0/renesas/android.hardware.sensors@1.0-service.renesas/android_vendor.30_arm64_armv8-a/unstripped/android.hardware.sensors@1.0-service.renesas

    2. ./qnx/qnx-sdp/host/linux/x86_64/usr/bin/ntoaarch64-nm-2.25 -a -S android.hardware.sensors@1.0-service.renesas

    or

    ./qnx/qnx-sdp/host/linux/x86_64/usr/bin/ntoaarch64-objdump-2.25 -t android.hardware.sensors@1.0-service.renesas

    3. get result   0000000000004a10 0000000000000038 T _ZN7android8hardware7sensors4V1_07renesas7SensorsD0Ev

    or

    0000000000004a10 g     F .text  0000000000000038              _ZN7android8hardware7sensors4V1_07renesas7SensorsD0Ev

    Usage:

    Usage: ./qnx/qnx-sdp/host/linux/x86_64/usr/bin/ntoaarch64-nm-2.25 [option(s)] [file(s)]
     List symbols in [file(s)] (a.out by default).
     The options are:
      -a, --debug-syms       Display debugger-only symbols
      -A, --print-file-name  Print name of the input file before every symbol
      -B                     Same as --format=bsd
      -C, --demangle[=STYLE] Decode low-level symbol names into user-level names
                              The STYLE, if specified, can be `auto' (the default),
                              `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'
                              or `gnat'
          --no-demangle      Do not demangle low-level symbol names
      -D, --dynamic          Display dynamic symbols instead of normal symbols
          --defined-only     Display only defined symbols
      -e                     (ignored)
      -f, --format=FORMAT    Use the output format FORMAT.  FORMAT can be `bsd',
                               `sysv' or `posix'.  The default is `bsd'
      -g, --extern-only      Display only external symbols
      -l, --line-numbers     Use debugging information to find a filename and
                               line number for each symbol
      -n, --numeric-sort     Sort symbols numerically by address
      -o                     Same as -A
      -p, --no-sort          Do not sort the symbols
      -P, --portability      Same as --format=posix
      -r, --reverse-sort     Reverse the sense of the sort
          --plugin NAME      Load the specified plugin
      -S, --print-size       Print size of defined symbols
      -s, --print-armap      Include index for symbols from archive members
          --size-sort        Sort symbols by size
          --special-syms     Include special symbols in the output
          --synthetic        Display synthetic symbols as well
      -t, --radix=RADIX      Use RADIX for printing symbol values
          --target=BFDNAME   Specify the target object format as BFDNAME
      -u, --undefined-only   Display only undefined symbols
      -X 32_64               (ignored)
      @FILE                  Read options from FILE
      -h, --help             Display this information
      -V, --version          Display this program's version number

    Usage: ./qnx/qnx-sdp/host/linux/x86_64/usr/bin/ntoaarch64-objdump-2.25
     Display information from object .
     At least one of the following switches must be given:
      -a, --archive-headers    Display archive header information
      -f, --file-headers       Display the contents of the overall file header
      -p, --private-headers    Display object format specific file header contents
      -P, --private=OPT,OPT... Display object format specific contents
      -h, --[section-]headers  Display the contents of the section headers
      -x, --all-headers        Display the contents of all headers
      -d, --disassemble        Display assembler contents of executable sections
      -D, --disassemble-all    Display assembler contents of all sections
      -S, --source             Intermix source code with disassembly
      -s, --full-contents      Display the full contents of all sections requested
      -g, --debugging          Display debug information in object file
      -e, --debugging-tags     Display debug information using ctags style
      -G, --stabs              Display (in raw form) any STABS info in the file
      -W[lLiaprmfFsoRt] or
      --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,
              =frames-interp,=str,=loc,=Ranges,=pubtypes,
              =gdb_index,=trace_info,=trace_abbrev,=trace_aranges,
              =addr,=cu_index]
                               Display DWARF info in the file
      -t, --syms               Display the contents of the symbol table(s)
      -T, --dynamic-syms       Display the contents of the dynamic symbol table
      -r, --reloc              Display the relocation entries in the file
      -R, --dynamic-reloc      Display the dynamic relocation entries in the file
      @                  Read options from
      -v, --version            Display this program's version number
      -i, --info               List object formats and architectures supported
      -H, --help               Display this information

     The following switches are optional:
      -b, --target=BFDNAME           Specify the target object format as BFDNAME
      -m, --architecture=MACHINE     Specify the target architecture as MACHINE
      -j, --section=NAME             Only display information for section NAME
      -M, --disassembler-options=OPT Pass text OPT on to the disassembler
      -EB --endian=big               Assume big endian format when disassembling
      -EL --endian=little            Assume little endian format when disassembling
          --file-start-context       Include context from start of file (with -S)
      -I, --include=DIR              Add DIR to search list for source files
      -l, --line-numbers             Include line numbers and filenames in output
      -F, --file-offsets             Include file offsets when displaying information
      -C, --demangle[=STYLE]         Decode mangled/processed symbol names
                                      The STYLE, if specified, can be `auto', `gnu',
                                      `lucid', `arm', `hp', `edg', `gnu-v3', `java'
                                      or `gnat'
      -w, --wide                     Format output for more than 80 columns
      -z, --disassemble-zeroes       Do not skip blocks of zeroes when disassembling
          --start-address=ADDR       Only process data whose address is >= ADDR
          --stop-address=ADDR        Only process data whose address is <= ADDR
          --prefix-addresses         Print complete address alongside disassembly
          --[no-]show-raw-insn       Display hex alongside symbolic disassembly
          --insn-width=WIDTH         Display WIDTH bytes on a single line for -d
          --adjust-vma=OFFSET        Add OFFSET to all displayed section addresses
          --special-syms             Include special symbols in symbol dumps
          --prefix=PREFIX            Add PREFIX to absolute paths for -S
          --prefix-strip=LEVEL       Strip initial directory names for -S
          --dwarf-depth=N        Do not display DIEs at depth N or greater
          --dwarf-start=N        Display DIEs starting with N, at the same depth
                                 or deeper
          --dwarf-check          Make additional dwarf internal consistency checks.      

    ./qnx/qnx-sdp/host/linux/x86_64/usr/bin/ntoaarch64-objdump-2.25: supported targets: elf64-littleaarch64 elf64-bigaarch64 elf32-littleaarch64 elf32-bigaarch64 elf32-littlearm elf32-bigarm elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
    ./qnx/qnx-sdp/host/linux/x86_64/usr/bin/ntoaarch64-objdump-2.25: supported architectures: aarch64 aarch64:ilp32 arm armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5te xscale ep9312 iwmmxt iwmmxt2 plugin

    The following AARCH64 specific disassembler options are supported for use
    with the -M switch (multiple options should be separated by commas):

      no-aliases         Don't print instruction aliases.

      aliases            Do print instruction aliases.


    The following ARM specific disassembler options are supported for use with
    the -M switch:
      reg-names-special-atpcs  Select special register names used in the ATPCS
      reg-names-atpcs          Select register names used in the ATPCS
      reg-names-apcs           Select register names used in the APCS
      reg-names-std            Select register names used in ARM's ISA documentation
      reg-names-gcc            Select register names used by GCC
      reg-names-raw            Select raw register names
      force-thumb              Assume all insns are Thumb insns
      no-force-thumb           Examine preceding label to determine an insn's type
     

  • 相关阅读:
    pgsql的窗口函数简述
    修改MySQL密码的四种方法(适合初学者)
    基于miniprogram-ci的微信小程序的CI以及接入钉钉通知
    elasticsearch 聚合之 date_histogram 聚合
    校企联动,促进就业丨四川文化产业职业学院领导一行莅临我司调研交流
    linux下的线程thread
    AIR780E二次开发点灯(LuatOS)
    Matlab:使用plot函数绘制数据曲线
    网络——介质访问控制
    Obsidian -知识库管理工具使用总结
  • 原文地址:https://blog.csdn.net/jackjones_008/article/details/127867047