[PATCH] D54747: Discard debuginfo for object files empty after GC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 01:07:23 PDT 2019


MaskRay added a comment.

In D54747#1342666 <https://reviews.llvm.org/D54747#1342666>, @rocallahan wrote:

> Here are some results for the rusoto test in https://github.com/rust-lang/rust/issues/56068#issue-382175735:
>
> | LLD                       | Binary size in bytes |
> | LLD 6.0.1                 | 43,791,192           |
> | LLD 8.0.0 1cfcf404f6b23943405bc3c5bb5940b10b914624               | 43,861,056           |
> | LLD 8.0.0 1cfcf404f6b23943405bc3c5bb5940b10b914624 `--start-lib` | 43,844,760           |
> | LLD 8.0.0 1cfcf404f6b23943405bc3c5bb5940b10b914624 + this patch  | 6,281,488            |
> |
>
> For `--start-lib` I wrapped `--start-lib`/`--end-lib` around all object files.
>
> As I expected `--start-lib` didn't make much difference. The dependencies containing debuginfo that I want to be GCed away are already packaged into static libraries before being passed to the final link.


The improvement of this patch looks really promising! Do you have numbers with ld.bfd and gold?



================
Comment at: lld/ELF/MarkLive.cpp:195
+    return;
+  if (!Sec->File || !ObjFile<ELFT>::classof(Sec->File))
+    return;
----------------
> `!ObjFile<ELFT>::classof(Sec->File)`

Can this happen?


================
Comment at: lld/ELF/MarkLive.cpp:199
+    Sec->getFile<ELFT>()->HasLiveCodeOrData = true;
+  }
+}
----------------
The brace is redundant.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54747/new/

https://reviews.llvm.org/D54747





More information about the llvm-commits mailing list