Don't emit a shstrtabindex in the reserved range. Spotted by inspection and
authorNick Lewycky <nicholas@mxc.ca>
Fri, 7 Oct 2011 20:58:24 +0000 (20:58 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Fri, 7 Oct 2011 20:58:24 +0000 (20:58 +0000)
patch by Cary Coutant!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141413 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/ELFObjectWriter.cpp

index 549a5099376f95c5210fb8513f3a893839b312ff..9bb64625654f2e89db1458e1047e30dffbaa78cb 100644 (file)
@@ -130,7 +130,7 @@ void ELFObjectWriter::WriteHeader(uint64_t SectionDataSize,
     Write16(NumberOfSections);
 
   // e_shstrndx  = Section # of '.shstrtab'
-  if (NumberOfSections >= ELF::SHN_LORESERVE)
+  if (ShstrtabIndex >= ELF::SHN_LORESERVE)
     Write16(ELF::SHN_XINDEX);
   else
     Write16(ShstrtabIndex);