[PATCH] D49371: [ELF] - Do not produce broken output when amount of sections is > ~65k

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 05:37:42 PDT 2018


grimar added inline comments.


================
Comment at: ELF/Writer.cpp:2272
+  if (OutputSections.size() + 1 >= SHN_LORESERVE)
+    SHdrs->sh_size = OutputSections.size() + 1;
+  else
----------------
peter.smith wrote:
> Should we explicitly set EHdr->e_shnum to 0 here as we've called it out in the comment. 
Above (line 2246) we have a code that does not do that, assuming fields are zero by default:

```
  if (!Config->Relocatable) {
    EHdr->e_phoff = sizeof(Elf_Ehdr);
    EHdr->e_phentsize = sizeof(Elf_Phdr);
  }
```

So to be consistent, I would not do that probably. Though both ways would be OK to me.


https://reviews.llvm.org/D49371





More information about the llvm-commits mailing list