davidlattimore / wild

A very fast linker for Linux
Apache License 2.0
670 stars 17 forks source link

.eh_frame contains more CIEs than needed #123

Open davidlattimore opened 2 months ago

davidlattimore commented 2 months ago
readelf -W --debug-dump=frames wild/tests/build/rust-integration.rs-llvm-dynamic.wild | grep CIE | wc -l
23
readelf -W --debug-dump=frames wild/tests/build/rust-integration.rs-llvm-dynamic.ld | grep CIE | wc -l
2

Wild GCs FDEs for sections that aren't used, but doesn't currently GC CIEs that aren't referenced by any FDEs.

marxin commented 2 months ago

Just providing statistics for the current main branch and other linkers (for Clang binary):

Mold:

.eh_frame_hdr                                                    1.2 MiB
.eh_frame                                                        9.7 MiB

LLD:

.eh_frame_hdr                                                    1.2 MiB
.eh_frame                                                        9.7 MiB

Wild:

.eh_frame_hdr                                                    1.1 MiB
.eh_frame                                                        9.0 MiB
davidlattimore commented 2 months ago

That's interesting that the total size of those sections is smaller. I wonder what's causing that. Especially given that Wild is emitting more CIEs. Perhaps Wild is emitting less FDEs for some reason.

If I use the commands from the first comment of this issue to look at the clang binary, I get 1 CIE for lld and 2746 for Wild. Worse, if I look at the rustc-driver shared object, I get 2 for all the linkers except for Wild, which ends up with 15025.