How do I determine the fastest link order?

前端 未结 4 624
小蘑菇
小蘑菇 2021-02-01 14:14

I have about 50 different static libraries being linked into my c++ project and the linking takes on average 70s.

I\'ve found that moving around with the link order of

4条回答
  •  无人及你
    2021-02-01 14:46

    Based on information comparing ld to gold, the speed of ld is affected by how big the symbol table is. As the symbol table grows from processing object files, the slower the link step becomes. So, if you have two different 1-pass linking orders, the one that puts the libraries with a larger number of symbols to fixup later in that order should link faster. You should be able to modify a topological sort to include symbol count in the ordering criteria.

提交回复
热议问题