10 changes: 5 additions & 5 deletions llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ FileHeader:
Machine: EM_X86_64
Sections:
## Valid.
- Name: '.stack_sizes [1]'
- Name: '.stack_sizes (1)'
Type: SHT_PROGBITS
Content: "100000000000000020"
## Truncated.
- Name: '.stack_sizes [2]'
- Name: '.stack_sizes (2)'
Type: SHT_PROGBITS
Content: "1000000000000000"
## Empty.
- Name: '.stack_sizes [3]'
- Name: '.stack_sizes (3)'
Type: SHT_PROGBITS
Content: ""

Expand Down Expand Up @@ -287,12 +287,12 @@ FileHeader:
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: '.stack_sizes [1]'
- Name: '.stack_sizes (1)'
Type: SHT_PROGBITS
Entries:
- Address: 0x10
Size: 0x20
- Name: '.stack_sizes [2]'
- Name: '.stack_sizes (2)'
Type: SHT_PROGBITS
Entries:
- Address: 0x30
Expand Down
4 changes: 2 additions & 2 deletions llvm/tools/obj2yaml/elf2yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ELFDumper<ELFT>::getUniquedSectionName(const Elf_Shdr *Sec) {

auto It = UsedSectionNames.insert({Name, 0});
if (!It.second)
Ret = (Name + " [" + Twine(++It.first->second) + "]").str();
Ret = ELFYAML::appendUniqueSuffix(Name, Twine(++It.first->second));
else
Ret = std::string(Name);
return Ret;
Expand Down Expand Up @@ -161,7 +161,7 @@ ELFDumper<ELFT>::getUniquedSymbolName(const Elf_Sym *Sym, StringRef StrTable,
auto It = UsedSymbolNames.insert({Name, 0});
if (!It.second)
SymbolNames[Index] =
(Name + " [" + Twine(++It.first->second) + "]").str();
ELFYAML::appendUniqueSuffix(Name, Twine(++It.first->second));
else
SymbolNames[Index] = std::string(Name);
return SymbolNames[Index];
Expand Down