[lld] r248133 - [ELF2] Implement support for -discard-locals.
Rafael Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 06:15:36 PDT 2015
> + if (Config->DiscardLocals && SymName->startswith(".L"))
> + continue;
> ESym->st_name = (SymName) ? StrTabSec.getFileOff(*SymName) : 0;
It is probably a good idea to make this a static helper
If you are interested in this area (controlling what goes in the
static symtab), I think what is missing is
* Add a --discard-none.
* The default is to keep every symbol except if
* The symbol is local (.L)
* The symbol is defined in a SHF_MERGE section
As an extension, I think we should consider symbols with no names as
locals too. They are created when MC manages to avoid creating a .L
symbol, so there is no point in keeping them when discarding .L ones.
On this test, it probably makes sense to include the ASCII rendering of .strtab.
More information about the llvm-commits