Skip to content

Commit

Permalink
ELFDumper: Unversioned symbols must not have trailing @
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280140 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Hemant Kulkarni committed Aug 30, 2016
1 parent a55b262 commit b16d4d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
8 changes: 4 additions & 4 deletions test/tools/llvm-readobj/elf-versioninfo.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ CHECK-NEXT: Link: 1
CHECK-NEXT: Symbols [
CHECK-NEXT: Symbol {
CHECK-NEXT: Version: 0
CHECK-NEXT: Name: @
CHECK-NEXT: Name:
CHECK-NEXT: }
CHECK-NEXT: Symbol {
CHECK-NEXT: Version: 1
CHECK-NEXT: Name: _end@
CHECK-NEXT: Name: _end
CHECK-NEXT: }
CHECK-NEXT: Symbol {
CHECK-NEXT: Version: 1
CHECK-NEXT: Name: _edata@
CHECK-NEXT: Name: _edata
CHECK-NEXT: }
CHECK-NEXT: Symbol {
CHECK-NEXT: Version: 3
CHECK-NEXT: Name: goo@@VERSION2
CHECK-NEXT: }
CHECK-NEXT: Symbol {
CHECK-NEXT: Version: 1
CHECK-NEXT: Name: __bss_start@
CHECK-NEXT: Name: __bss_start
CHECK-NEXT: }
CHECK-NEXT: Symbol {
CHECK-NEXT: Version: 2
Expand Down
18 changes: 9 additions & 9 deletions test/tools/llvm-readobj/mips-got.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GOT-EXE-NEXT: Initial: 0x0
GOT-EXE-NEXT: Value: 0x0
GOT-EXE-NEXT: Type: Function (0x2)
GOT-EXE-NEXT: Section: Undefined (0x0)
GOT-EXE-NEXT: Name: __gmon_start__@ (1)
GOT-EXE-NEXT: Name: __gmon_start__ (1)
GOT-EXE-NEXT: }
GOT-EXE-NEXT: ]
GOT-EXE-NEXT: Number of TLS and multi-GOT entries: 0
Expand Down Expand Up @@ -124,7 +124,7 @@ GOT-SO-NEXT: Initial: 0x0
GOT-SO-NEXT: Value: 0x0
GOT-SO-NEXT: Type: None (0x0)
GOT-SO-NEXT: Section: Undefined (0x0)
GOT-SO-NEXT: Name: _ITM_registerTMCloneTable@ (87)
GOT-SO-NEXT: Name: _ITM_registerTMCloneTable (87)
GOT-SO-NEXT: }
GOT-SO-NEXT: Entry {
GOT-SO-NEXT: Address: 0x1090C
Expand All @@ -133,7 +133,7 @@ GOT-SO-NEXT: Initial: 0x0
GOT-SO-NEXT: Value: 0x0
GOT-SO-NEXT: Type: None (0x0)
GOT-SO-NEXT: Section: Undefined (0x0)
GOT-SO-NEXT: Name: _Jv_RegisterClasses@ (128)
GOT-SO-NEXT: Name: _Jv_RegisterClasses (128)
GOT-SO-NEXT: }
GOT-SO-NEXT: Entry {
GOT-SO-NEXT: Address: 0x10910
Expand All @@ -142,7 +142,7 @@ GOT-SO-NEXT: Initial: 0x0
GOT-SO-NEXT: Value: 0x0
GOT-SO-NEXT: Type: Function (0x2)
GOT-SO-NEXT: Section: Undefined (0x0)
GOT-SO-NEXT: Name: __gmon_start__@ (23)
GOT-SO-NEXT: Name: __gmon_start__ (23)
GOT-SO-NEXT: }
GOT-SO-NEXT: Entry {
GOT-SO-NEXT: Address: 0x10914
Expand All @@ -160,7 +160,7 @@ GOT-SO-NEXT: Initial: 0x0
GOT-SO-NEXT: Value: 0x0
GOT-SO-NEXT: Type: None (0x0)
GOT-SO-NEXT: Section: Undefined (0x0)
GOT-SO-NEXT: Name: _ITM_deregisterTMCloneTable@ (59)
GOT-SO-NEXT: Name: _ITM_deregisterTMCloneTable (59)
GOT-SO-NEXT: }
GOT-SO-NEXT: Entry {
GOT-SO-NEXT: Address: 0x1091C
Expand Down Expand Up @@ -256,7 +256,7 @@ GOT-TLS-NEXT: Initial: 0x0
GOT-TLS-NEXT: Value: 0x0
GOT-TLS-NEXT: Type: None (0x0)
GOT-TLS-NEXT: Section: Undefined (0x0)
GOT-TLS-NEXT: Name: _ITM_registerTMCloneTable@ (78)
GOT-TLS-NEXT: Name: _ITM_registerTMCloneTable (78)
GOT-TLS-NEXT: }
GOT-TLS-NEXT: Entry {
GOT-TLS-NEXT: Address: 0x10C70
Expand All @@ -265,7 +265,7 @@ GOT-TLS-NEXT: Initial: 0x0
GOT-TLS-NEXT: Value: 0x0
GOT-TLS-NEXT: Type: None (0x0)
GOT-TLS-NEXT: Section: Undefined (0x0)
GOT-TLS-NEXT: Name: _Jv_RegisterClasses@ (119)
GOT-TLS-NEXT: Name: _Jv_RegisterClasses (119)
GOT-TLS-NEXT: }
GOT-TLS-NEXT: Entry {
GOT-TLS-NEXT: Address: 0x10C78
Expand All @@ -274,7 +274,7 @@ GOT-TLS-NEXT: Initial: 0x0
GOT-TLS-NEXT: Value: 0x0
GOT-TLS-NEXT: Type: Function (0x2)
GOT-TLS-NEXT: Section: Undefined (0x0)
GOT-TLS-NEXT: Name: __gmon_start__@ (23)
GOT-TLS-NEXT: Name: __gmon_start__ (23)
GOT-TLS-NEXT: }
GOT-TLS-NEXT: Entry {
GOT-TLS-NEXT: Address: 0x10C80
Expand All @@ -292,7 +292,7 @@ GOT-TLS-NEXT: Initial: 0x0
GOT-TLS-NEXT: Value: 0x0
GOT-TLS-NEXT: Type: None (0x0)
GOT-TLS-NEXT: Section: Undefined (0x0)
GOT-TLS-NEXT: Name: _ITM_deregisterTMCloneTable@ (50)
GOT-TLS-NEXT: Name: _ITM_deregisterTMCloneTable (50)
GOT-TLS-NEXT: }
GOT-TLS-NEXT: Entry {
GOT-TLS-NEXT: Address: 0x10C90
Expand Down
3 changes: 3 additions & 0 deletions tools/llvm-readobj/ELFDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,9 @@ std::string ELFDumper<ELFT>::getFullSymbolName(const Elf_Sym *Symbol,

bool IsDefault;
StringRef Version = getSymbolVersion(StrTable, &*Symbol, IsDefault);
// Unversioned symbol must not have any suffix @
if (!IsDefault && Version == "")
return FullSymbolName;
FullSymbolName += (IsDefault ? "@@" : "@");
FullSymbolName += Version;
return FullSymbolName;
Expand Down

0 comments on commit b16d4d3

Please sign in to comment.