This is https://bugs.llvm.org/show_bug.cgi?id=39493.
We crashed previously because did not handle /DISCARD/ properly
when -r was used. I think it is uncommon to use scripts with -r, though I see
nothing wrong to handle the /DISCARD/ so that we will not crash at least.
This bit of code looks like it could be merged with if (Config->EmitRelocs) on line 692
By doing so we wouldn't be skipping the code at 672 for Config->Relocatable I don't think that this code has any side-effects that would affect a discarded section though.