[PATCH] D67094: [llvm-readelf] - Print unknown st_other value if present in GNU output.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 02:47:22 PDT 2019


grimar added inline comments.


================
Comment at: tools/llvm-readobj/ELFDumper.cpp:3256
   Field Fields[8] = {0,         8,         17 + Bias, 23 + Bias,
-                     31 + Bias, 38 + Bias, 47 + Bias, 51 + Bias};
+                     31 + Bias, 38 + Bias, 48 + Bias, 51 + Bias};
   Fields[0].Str = to_string(format_decimal(Idx++, 6)) + ":";
----------------
jhenderson wrote:
> grimar wrote:
> > jhenderson wrote:
> > > What's this change about?
> > Before this patch "Ndx" row was 1 space off for the case when the "PROTECTED" visibility (has the longest spelling) was printed.
> Okay. Does the changed format match up with GNU readelf?
Nope. And wasn't before. GNU output is off for Ndx and Name:

```
Symbol table '.symtab' contains 5 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND default
     2: 00000000     0 NOTYPE  GLOBAL INTERNAL  UND internal
     3: 00000000     0 NOTYPE  GLOBAL HIDDEN   UND hidden
     4: 00000000     0 NOTYPE  GLOBAL PROTECTED  UND protected
```

We do not need to try be bug compatible here it seems, since we improve the alignment in favor of readability.

Our output is perfect now:

```
Symbol table '.symtab' contains 5 entries:
   Num:    Value  Size Type    Bind   Vis       Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT   UND
     1: 00000000     0 NOTYPE  GLOBAL DEFAULT   UND default
     2: 00000000     0 NOTYPE  GLOBAL INTERNAL  UND internal
     3: 00000000     0 NOTYPE  GLOBAL HIDDEN    UND hidden
     4: 00000000     0 NOTYPE  GLOBAL PROTECTED UND protected
```


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

https://reviews.llvm.org/D67094





More information about the llvm-commits mailing list