diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index a1a3d593efb..2c66941bc41 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -2466,7 +2466,7 @@ symbol_iterator ELFObjectFile::begin_symbols() const { SymbolData.d.a = 0; SymbolData.d.b = 0; } else { - SymbolData.d.a = 1; // The 0th symbol in ELF is fake. + SymbolData.d.a = 0; SymbolData.d.b = SymbolTableIndex; } return symbol_iterator(SymbolRef(SymbolData, this)); @@ -2493,7 +2493,7 @@ symbol_iterator ELFObjectFile::begin_dynamic_symbols() const { SymbolData.d.a = 0; SymbolData.d.b = 0; } else { - SymbolData.d.a = 1; // The 0th symbol in ELF is fake. + SymbolData.d.a = 0; SymbolData.d.b = DynamicSymbolTableIndex; } return symbol_iterator(SymbolRef(SymbolData, this)); diff --git a/test/MC/ELF/alias-reloc.s b/test/MC/ELF/alias-reloc.s index f5448e5ffb5..0ee73e9ca24 100644 --- a/test/MC/ELF/alias-reloc.s +++ b/test/MC/ELF/alias-reloc.s @@ -25,7 +25,16 @@ foo2: // CHECK-NEXT: ] // CHECK: Symbols [ -// CHECK: Symbol { +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: bar // CHECK-NEXT: Value: 0x0 // CHECK-NEXT: Size: 0 diff --git a/test/MC/ELF/alias.s b/test/MC/ELF/alias.s index 0575f41fc85..8da75f7ef2d 100644 --- a/test/MC/ELF/alias.s +++ b/test/MC/ELF/alias.s @@ -19,6 +19,15 @@ bar4 = foo4 // CHECK: Symbols [ // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: bar // CHECK-NEXT: Value: 0x0 // CHECK-NEXT: Size: 0 diff --git a/test/MC/ELF/weakref.s b/test/MC/ELF/weakref.s index 87173641b56..6c2d33397c8 100644 --- a/test/MC/ELF/weakref.s +++ b/test/MC/ELF/weakref.s @@ -71,6 +71,15 @@ bar15: // CHECK: Symbols [ // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: bar6 (21) // CHECK-NEXT: Value: 0x18 // CHECK-NEXT: Size: 0 diff --git a/test/tools/llvm-readobj/symbols.test b/test/tools/llvm-readobj/symbols.test index d33bd8ed2cd..e014377e586 100644 --- a/test/tools/llvm-readobj/symbols.test +++ b/test/tools/llvm-readobj/symbols.test @@ -25,6 +25,15 @@ COFF-NEXT: } ELF: Symbols [ ELF-NEXT: Symbol { +ELF-NEXT: Name: (0) +ELF-NEXT: Value: 0x0 +ELF-NEXT: Size: 0 +ELF-NEXT: Binding: Local (0x0) +ELF-NEXT: Type: None (0x0) +ELF-NEXT: Other: 0 +ELF-NEXT: Section: (0x0) +ELF-NEXT: } +ELF-NEXT: Symbol { ELF-NEXT: Name: trivial.ll (1) ELF-NEXT: Value: 0x0 ELF-NEXT: Size: 0