[lld] r358248 - [ELF] Fix typo: .symtab_shndxr -> .symtab_shndx

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 19:20:53 PDT 2019


Author: maskray
Date: Thu Apr 11 19:20:52 2019
New Revision: 358248

URL: http://llvm.org/viewvc/llvm-project?rev=358248&view=rev
Log:
[ELF] Fix typo: .symtab_shndxr -> .symtab_shndx

The typo was introduced to llvm MC in rL204769 (fixed in rL358247) and then to lld.

Also, for relocatable-many-sections.s, the size of .symtab changed at some point and the formula needs update.

Modified:
    lld/trunk/ELF/InputFiles.h
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/test/ELF/linkerscript/orphan-report.s
    lld/trunk/test/ELF/relocatable-many-sections.s

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=358248&r1=358247&r2=358248&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Thu Apr 11 19:20:52 2019
@@ -263,11 +263,11 @@ private:
   // equal to or smaller than 65280.
   //
   // If an object file contains more than 65280 sections, the file must
-  // contain .symtab_shndxr section. The section contains an array of
+  // contain .symtab_shndx section. The section contains an array of
   // 32-bit integers whose size is the same as the number of symbols.
-  // Nth symbol's section index is in the Nth entry of .symtab_shndxr.
+  // Nth symbol's section index is in the Nth entry of .symtab_shndx.
   //
-  // The following variable contains the contents of .symtab_shndxr.
+  // The following variable contains the contents of .symtab_shndx.
   // If the section does not exist (which is common), the array is empty.
   ArrayRef<Elf_Word> ShndxTable;
 

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=358248&r1=358247&r2=358248&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Apr 11 19:20:52 2019
@@ -2067,7 +2067,7 @@ template <class ELFT> void SymbolTableSe
 }
 
 SymtabShndxSection::SymtabShndxSection()
-    : SyntheticSection(0, SHT_SYMTAB_SHNDX, 4, ".symtab_shndxr") {
+    : SyntheticSection(0, SHT_SYMTAB_SHNDX, 4, ".symtab_shndx") {
   this->Entsize = 4;
 }
 
@@ -2088,7 +2088,7 @@ bool SymtabShndxSection::isNeeded() cons
   // SHN_LORESERVE. If we need more, we want to use extension SHT_SYMTAB_SHNDX
   // section. Problem is that we reveal the final section indices a bit too
   // late, and we do not know them here. For simplicity, we just always create
-  // a .symtab_shndxr section when the amount of output sections is huge.
+  // a .symtab_shndx section when the amount of output sections is huge.
   size_t Size = 0;
   for (BaseCommand *Base : Script->SectionCommands)
     if (isa<OutputSection>(Base))

Modified: lld/trunk/test/ELF/linkerscript/orphan-report.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/orphan-report.s?rev=358248&r1=358247&r2=358248&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/orphan-report.s (original)
+++ lld/trunk/test/ELF/linkerscript/orphan-report.s Thu Apr 11 19:20:52 2019
@@ -36,7 +36,7 @@
 # REPORT-NEXT: <internal>:(.plt) is being placed in '.plt'
 # REPORT-NEXT: <internal>:(.eh_frame) is being placed in '.eh_frame'
 # REPORT-NEXT: <internal>:(.symtab) is being placed in '.symtab'
-# REPORT-NEXT: <internal>:(.symtab_shndxr) is being placed in '.symtab_shndxr'
+# REPORT-NEXT: <internal>:(.symtab_shndx) is being placed in '.symtab_shndx'
 # REPORT-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
 # REPORT-NEXT: <internal>:(.strtab) is being placed in '.strtab'
 

Modified: lld/trunk/test/ELF/relocatable-many-sections.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocatable-many-sections.s?rev=358248&r1=358247&r2=358248&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocatable-many-sections.s (original)
+++ lld/trunk/test/ELF/relocatable-many-sections.s Thu Apr 11 19:20:52 2019
@@ -14,18 +14,18 @@
 
 ## Check that:
 ## 1) 65541 is the index of .shstrtab section.
-## 2) .symtab_shndxr is linked with .symtab.
-## 3) .symtab_shndxr entry size and alignment == 4.
-## 4) .symtab_shndxr has size equal to
-##    (sizeof(.symtab) / entsize(.symtab)) * entsize(.symtab_shndxr) = 0x4 * 0x180048 / 0x18 == 0x04000c
+## 2) .symtab_shndx is linked with .symtab.
+## 3) .symtab_shndx entry size and alignment == 4.
+## 4) .symtab_shndx has size equal to
+##    (sizeof(.symtab) / entsize(.symtab)) * entsize(.symtab_shndx) = 0x4 * 0x180078 / 0x18 == 0x040014
 
 # RUN: llvm-readelf -sections -symbols %t | FileCheck %s
 #        [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
 # CHECK: [65539] .note.GNU-stack PROGBITS       0000000000000000 000040 000000 00      0   0  1
 # CHECK: [65540] .symtab        SYMTAB          0000000000000000 000040 180078 18     65543 65539  8
-# CHECK: [65541] .symtab_shndxr SYMTAB SECTION INDICES 0000000000000000 1800b8 040014 04     65540   0  4
-# CHECK: [65542] .shstrtab      STRTAB          0000000000000000 1c00cc 0f0045 00      0   0  1
-# CHECK: [65543] .strtab        STRTAB          0000000000000000 2b0111 00000c 00      0   0  1
+# CHECK: [65541] .symtab_shndx  SYMTAB SECTION INDICES 0000000000000000 1800b8 040014 04     65540   0  4
+# CHECK: [65542] .shstrtab      STRTAB          0000000000000000 1c00cc 0f0044 00      0   0  1
+# CHECK: [65543] .strtab        STRTAB          0000000000000000 2b0110 00000c 00      0   0  1
 
 # 5) Check we are able to represent symbol foo with section (.bar) index  > 0xFF00 (SHN_LORESERVE).
 # CHECK: GLOBAL DEFAULT  65538 foo




More information about the llvm-commits mailing list