crazy idea: Make all temporary symbols unnamed

Rui Ueyama ruiu at
Wed Jun 17 14:41:59 PDT 2015

COFF spec is not clear about whether symbols can be unnamed or not, but as
far as I tried, at least MSVC accepts that. I replaced all symbols starting
with L_ with empty strings using yaml2obj/obj2yaml, and the resulting
object file still worked with link.exe.

On Wed, Jun 17, 2015 at 10:09 AM, Rafael EspĂ­ndola <
rafael.espindola at> wrote:

> The attached patch is a work in progress.
> What it does is make all symbols that would otherwise start with a .L
> (or L on MachO) unnamed.
> There are two issues to be aware of:
> * Some of these symbols can show up in the symbol table.
> * We still want to produce binary identical files when going through
> assembly files.
> If the first one is handled, the second one goes away by making sure
> we ignore the name of *all* .L symbols: we pick one when writing
> assembly, but it never shows up in the final .o.
> In this patch I have handled the first issue only in the ELF writer by
> supporting unnamed symbols.
> Can symbols be unnamed on COFF and MachO? If not, I think we could
> still do this and let those object writers invent a deterministic name
> at the very end, no?
> I tested this locally by doing a bootstrap.
> I tested the memory savings for llvm-mc are quite noticeable. When
> assembly a LTO llvm-as, the memory usage goes from 45,952,208 to
> 39,137,568 bytes.
> Cheers,
> Rafael
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the llvm-commits mailing list