[PATCH] D61647: llvm-objdump: when ELF st_other field is set, print its value before symbol name

Alfredo Dal'Ava JĂșnior via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 15:30:05 PDT 2019


adalava added a comment.

In D61647#1494070 <https://reviews.llvm.org/D61647#1494070>, @sfertile wrote:

> This definitely seems a useful upgrade to me. Unfortunately it might affect **a lot **of lit tests.  If we do intend to make a change we should try to match the output of the binutils objdump. I can see from the surrounding context we print out '.hidden', having a quick look it seems binutils will print out the visibility if its the only thing set, and the hex value otherwise (ie not both)  here is an example:


@sfertile, here's the result with your code on FreeBSD environment:

**Binutils objdump 2.30**

  powerpc64-unknown-freebsd12.0-objdump -t other.o 
  
  other.o:     file format elf64-powerpc-freebsd
  
  SYMBOL TABLE:
  0000000000000000 l    df *ABS*	0000000000000000 other.c
  0000000000000000 l    d  .toc	0000000000000000 .toc
  0000000000000000         *UND*	0000000000000000 .TOC.
  0000000000000000 g     O .data	0000000000000004 a
  0000000000000070 g     F .text	0000000000000048 0x60 bar
  0000000000000024 g     F .text	0000000000000024 0x63 exported_func
  0000000000000000  w    F .text	0000000000000024 0x62 foo
  000000000000005c g     F .text	0000000000000014 .hidden internal_func
  0000000000000048 g     F .text	0000000000000014 .protected single_entry

**LLVM9 objdump**

  llvm-objdump -t other.o 
  
  other.o:	file format ELF64-ppc64
  
  SYMBOL TABLE:
  0000000000000000 l    df *ABS*		 00000000 other.c
  0000000000000000 l    d  .toc		 00000000 .toc
  0000000000000000         *UND*		 00000000 .TOC.
  0000000000000000 g     O .data		 00000004 a
  0000000000000070 g     F .text		 00000048 0x60 bar
  0000000000000024 g     F .text		 00000024 0x63 exported_func
  0000000000000000 gw    F .text		 00000024 .hidden 0x62 foo
  000000000000005c g     F .text		 00000014 .hidden 0x2 internal_func
  0000000000000048 g     F .text		 00000014 0x3 single_entry

Based on your example I list the following differences we should probably work on:

1. if just .hidden is set, print .hidden and omit st_other value
2. if .hidden and other bits are set, print only st_other value
3. if just .protect  is set, print .protected  (and probably follow rule above when other bits are set too
4. on symbol size column add leading zeros up to 16 positions instead of 8

I'm not sure about ELF Symbol Binding flags. Need to check if llvm-objdump is missing the "g" flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61647





More information about the llvm-commits mailing list