See the updated insert-before.test for the effects: many synthetic
sections are SHF_ALLOC|SHF_WRITE. If they are discarded, we don't want
to propagate their flags to subsequent output section descriptions.
getFirstInputSection(sec) == nullptr can technically be merged into isDiscardable
but I'd like to postpone as not sharing getFirstInputSection(sec) == nullptr may give more refactoring .opportunity.
Depends on D118529.
I believe that all uses of isDiscardable() are now combined with getFirstInputSection() == nullptr, so perhaps getFirstInputSection() == nullptr should be part of isDiscardable()? Although that doesn't really "help" here as you need isEmpty.