[llvm] [Object,ELF] Implement PN_XNUM extension for program headers (PR #162288)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 22:41:36 PDT 2025


================
@@ -278,9 +278,26 @@ class ELFFile {
   std::vector<Elf_Shdr> FakeSections;
   SmallString<0> FakeSectionStrings;
 
+  //
+  // According to the ELF gABI, these three fields can be recorded in section 0
----------------
MaskRay wrote:

Remove the first `//` and last `//` lines. Suggested a separate comment for each variable

```
// When the number of program headers is >= 0xffff, the actual number is contained in the ... field of the section header at index 0.
std::optional<uint32_t> RealPhNum;
// When the number of section headers is >= 0xff00, the actual number is contained in the sh_size field ...
std::optional<uint32_t> RealShNum;
// ...
```

https://github.com/llvm/llvm-project/pull/162288


More information about the llvm-commits mailing list