GNU ld doesn't seem to support --icf at all, but this was suggested in D39885, and GNU gold seems to support it.
Details
Diff Detail
Event Timeline
MinGW/Driver.cpp | ||
---|---|---|
173–175 | I think this might be a more idiomatic way to write this: if (Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false)) Add("-opt:ref"); else Add("-opt:noref"); | |
180 | I don't think LLD has support for safe ICF. Safe ICF leveraged certain x86_32 ELF relocations that COFF lacks, and failing that, relies on knowledge about the Itanium C++ name mangling rules. LLD doesn't implement anything like that. LLD's ICF totally breaks function pointer identity. I would make --icf=all imply -opt:icf, otherwise -opt:noicf. Also, this is likely to need changes in the near future if we make -opt:icf fold identical comdats of readonly data again. We'll need a way to say "only fold identical code". |
I think this might be a more idiomatic way to write this: