[PATCH] D61117: Fix Bug 41353 - unique symbols printed as D instead of u

Mike Pozulp via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 21:49:34 PDT 2019


mmpozulp marked an inline comment as done.
mmpozulp added inline comments.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:911-912
       return 'b';
+    if (Binding == ELF::STB_GNU_UNIQUE)
+      return 'u';
     if (Flags & ELF::SHF_ALLOC)
----------------
jhenderson wrote:
> I don't know how realistic this is, but is this the right order of precedence for unique symbols, compared with GNU nm? In other words, do executable and NOBITS sections containing these symbols result in 't'/'b'?
STB_GNU_UNIQUE precedence is high. I tested 5 different cases with GNU nm version 2.27-34.base.el7 to make sure llvm-nm agrees (see below), and added those tests to this patch. What do you think, @jhenderson?

```
--- !ELF
FileHeader:    
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:    
  - Name:  .data
    Type:  XXX
Symbols:    
  - Name:    foo 
    Section: .data
    Binding: STB_GNU_UNIQUE
```
```
XXX             nm  llvm-nm
SHT_PROGBITS    u   u
SHT_NOBITS      u   u
```

```
--- !ELF
FileHeader:    
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:    
  - Name:  .data
    Type:  SHT_PROGBITS
    Flags: [YYY]
Symbols:    
  - Name:    foo 
    Section: .data
    Binding: STB_GNU_UNIQUE
```
```
YYY                     nm  llvm-nm
SHF_EXECINSTR           u   u
SHF_ALLOC               u   u
SHF_ALLOC, SHF_WRITE    u   u
```


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61117





More information about the llvm-commits mailing list