[PATCH] D139097: [ARM] Add option --print-raw-value to llvm-nm to dump raw symbol values in case of ARM

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 02:19:43 PST 2022


peter.smith added a comment.

In D139097#3966468 <https://reviews.llvm.org/D139097#3966468>, @shankare wrote:

> Shouldn't nm just print the raw value stored in the symbol table like what readelf does ?
>
>   $ llvm-readelf -s a.o
>   
>   Symbol table '.symtab' contains 2 entries:
>      Num:    Value  Size Type    Bind   Vis       Ndx Name
>        0: 00000000     0 NOTYPE  LOCAL  DEFAULT   UND
>        1: 00001003     0 FUNC    GLOBAL DEFAULT     1 foo
>
>
>
>   $ llvm-nm a.o
>   00001002 T foo

I guess it depends on what nm is supposed to output, is it the address of the symbol, or its raw value? Both interpretations seem reasonable. It all depends on what the authors of `aeabi-none-elf-nm` or `aeabi-linux-gnueabihf-nm` intended. It may be that this was not intended behaviour and it drops out of GNU nm using BFD (could be worth a post to the binutils mailing list). However if the intent of this patch is to make llvm-nm more like GNU nm, then I think we shouldn't remove the Arm and Mips specific behaviour as this moves it away from `arm-none-elf-nm` (and other arm-* targets).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139097/new/

https://reviews.llvm.org/D139097



More information about the llvm-commits mailing list