@@ -278,14 +278,15 @@ class ELFFile {
278278 std::vector<Elf_Shdr> FakeSections;
279279 SmallString<0 > FakeSectionStrings;
280280
281- // When the number of program headers is >= 0xffff , the actual number is
281+ // When the number of program headers is >= PN_XNUM , the actual number is
282282 // contained in the sh_info field of the section header at index 0.
283283 std::optional<uint32_t > RealPhNum;
284- // When the number of section headers is >= 0xff00 , the actual number is
285- // contained in the sh_size field of the section header at index 0.
284+ // When the number of section headers is >= SHN_LORESERVE , the actual number
285+ // is contained in the sh_size field of the section header at index 0.
286286 std::optional<uint64_t > RealShNum;
287- // When the index of str section is >= 0xff00, the actual number is
288- // contained in the sh_link field of the section header at index 0.
287+ // When the section index of the section name table is >= SHN_LORESERVE, the
288+ // actual number is contained in the sh_link field of the section header at
289+ // index 0.
289290 std::optional<uint32_t > RealShStrNdx;
290291
291292 ELFFile (StringRef Object);
@@ -935,10 +936,7 @@ template <class ELFT> Error ELFFile<ELFT>::readShdrZero() {
935936 Header.e_shoff != 0 ) {
936937 // Pretend we have section 0 or sections() would call getShNum and thus
937938 // become an infinite recursion.
938- if (Header.e_shnum == 0 )
939- RealShNum = 1 ;
940- else
941- RealShNum = Header.e_shnum ;
939+ RealShNum = 1 ;
942940 auto SecOrErr = getSection (0 );
943941 if (!SecOrErr) {
944942 RealShNum = std::nullopt ;
0 commit comments