One "use" of SHT_NULL
is that it is mandatory for the first header table entry (index 0, named SHN_UNDEF
), which is magic.
This is documented on the System V ABI Update (recommended by the LSB):
If the number of sections is greater than or equal to SHN_LORESERVE (0xff00), e_shnum has the value SHN_UNDEF (0) and the actual number of section header table entries is contained in the sh_size field of the section header at index 0 (otherwise, the sh_size member of the initial entry contains 0).
and:
Other section type values are reserved. As mentioned before, the section header for index 0 (SHN_UNDEF) exists, even though the index marks undefined section references. This entry holds the following.
followed by a table that specifies what each entry of he section header means in that special case. In particular, sh_type
must be SHT_NULL
.
From the above, this first section seems to exist to allow a large number of sections to be encoded, but I haven't tested kernel and compiler support.