Adapted from an example in PR35478. If in the future we are going to ignore zero sized sections we need to account for linker scripts with location counter expressions or data creating functions such as BYTE. These linker script commands may be evaluated late on so testing early for OutputSection size will miss them.
This should only be committed once the revert of r318924 has been done (D40710).
I feel like these should be in two separate links. By combining the two, if one is correctly seen as influencing the size, but not the other, we won't notice.