This fixes PR36598.
LLD currently crashes when we have empty output section
with SHF_LINK_ORDER flag. This might happen if we place an empty
synthetic section in the linker script, but keep output section alive with the
use of additional symbol, for example.
The patch fixes the issue by dropping all special flags for empty sections.
I believe this patch is correct, but this logic seems a bit weird to me. If an section is empty, we reset the section flag, but we also discard the section. If the section is discarded, why does its flag matter? Why do you have to reset it just before discarding it?