Our code assumes all input sections in an output SHF_LINK_ORDER section has SHF_LINK_ORDER flag.
We do not check that and that can cause a crash.
That happens because we call
std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition);,
where compareByFilePosition does not expect to see null when calls getLinkOrderDep.
Given that we never faced it before, I suggest to error out that case.
The same might happen when sections refer to non-regular sections.
Test cases demonstrate the issues.