This adds support for the --discard-locals flag, which acts similarly to --discard-all, except it only applies to compiler-generated symbols (i.e. symbols starting with .L in ELF).
I am not sure about COFF local symbols: those appear to also use .L in most cases, but also use just L in other cases, so for now I am just leaving it unimplemented there.
Fixes PR36160
You can probably get rid of this and the LocalFile symbol below, and just keep the .L versions of those symbols. They don't provide any additional coverage.