[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
Mon May 13 13:30:00 PDT 2019
mmpozulp added inline comments.
================
Comment at: llvm/test/tools/llvm-nm/X86/unique.test:13
+#
+# RUN: yaml2obj < %s | llvm-nm - | FileCheck %s
+
----------------
grimar wrote:
> The header you wrote looks nice for me personally, but the problem that it is inconsistent
> with other tests (I do not think we usually write how the llvm-mc was called for the very trivial cases like this).
>
> Also, the problem is that your YAML has more sections than needed. (And removing the sections would need to
> update your comment about how the YAML was produced, what is probably does not make value here since it
> is a very simple case which just does not need llvm-mc I think).
>
> So I think you can just use:
>
> ```
> ## Check that we print 'u' for unique symbols
> # RUN: yaml2obj < %s | llvm-nm - | FileCheck %s
>
> --- !ELF
> FileHeader:
> Class: ELFCLASS64
> Data: ELFDATA2LSB
> Type: ET_REL
> Machine: EM_X86_64
> Sections:
> - Name: .data
> Type: SHT_PROGBITS
> Flags: [ SHF_WRITE, SHF_ALLOC ]
> AddressAlign: 0x0000000000000001
> Content: '00'
> Symbols:
> - Name: foo
> Type: STT_OBJECT
> Section: .data
> Binding: STB_GNU_UNIQUE
> ...
>
> # CHECK: 0000000000000000 u foo
> ```
>
> Or even may be:
>
> ```
> ## Check that we print 'u' for unique symbols
> # RUN: yaml2obj < %s | llvm-nm - | FileCheck %s
>
> --- !ELF
> FileHeader:
> Class: ELFCLASS64
> Data: ELFDATA2LSB
> Type: ET_REL
> Machine: EM_X86_64
> Symbols:
> - Name: foo
> Binding: STB_GNU_UNIQUE
> ...
>
> # CHECK: 0000000000000000 u foo
> ```
Good suggestion! The smallest yaml file that I could achieve is
```
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
Symbols:
- Name: foo
Section: .data
Binding: STB_GNU_UNIQUE
```
If I delete the .data section I get 'U' since the symbol is now undefined. I also noticed that if I delete
```
Flags: [ SHF_WRITE, SHF_ALLOC ]
```
nm reports 'u' but llvm-nm reports 'n'. If I also delete
```
Binding: STB_GNU_UNIQUE
```
nm reports 'd' but llvm-nm reports 'n'. I assume that these situations don't arise in reality so we don't care.
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